Schema and Indices API documentation version 1.1
https://{customized.host}/{version}
- customized.host: required(string)
- version: required(1.1)
/schemas/{className}
schema management
get the schema of class.
add/update(merge) schema for class.
get /schemas/{className}
get the schema of class.
通过应用的 MasterKey 鉴权
URI Parameters
- className: required(string)
HTTP status code 200
Body
Media type: application/json
Type: object
Example:
{
"objectId" : {
"type" : "String"
},
"ACL" : {
"type" : "ACL"
},
"createdAt" : null,
"updatedAt" : null,
"content" : {
"type" : "String"
},
"pubUser" : {
"type" : "String"
},
"pubTimestamp" : {
"type" : "Number"
},
"tags" : {
"type" : "Array"
}
}
Secured by appMasterKey
Headers
- X-LC-Id: required(appId)
- X-LC-Sign: required(string)
请参考「更安全的鉴权方式」来提供 sign, https://leancloud.cn/docs/rest_api.html#hash-1794863242
Example:
e074720658078c898aa0d4b1b82bdf4b,1453014943466,master
HTTP status code 401
如果鉴权失败会返回 401 错误。
post /schemas/{className}
add/update(merge) schema for class.
通过应用的 MasterKey 鉴权
URI Parameters
- className: required(string)
Body
Media type: application/json
Type: object
Example:
{
"content": "每个 Java 程序员必备的 8 个开发工具",
"pubUser": "LeanCloud官方客服",
"pubTimestamp": 1435541999
}
Secured by appMasterKey
Headers
- X-LC-Id: required(appId)
- X-LC-Sign: required(string)
请参考「更安全的鉴权方式」来提供 sign, https://leancloud.cn/docs/rest_api.html#hash-1794863242
Example:
e074720658078c898aa0d4b1b82bdf4b,1453014943466,master
HTTP status code 401
如果鉴权失败会返回 401 错误。
/indices/{className}
index management
Create new index for specified class.
Find and query indices
post /indices/{className}
Create new index for specified class.
通过应用的 MasterKey 鉴权
URI Parameters
- className: required(string)
Body
Media type: application/json
Type: object
Properties- keys: required(object)
Example:
{ "item": 1, "quantity": -1 }
- unique: (boolean)
indicates whether the index is unique or not.
Example:
true
- sparse: (boolean)
indicates whether the index is sparse or not.
Example:
true
- indexName: (string)
index name.
Example:
query for inventory
Example:
{
"keys": {"pubTimestamp": 1, "pubUser": 1},
"unique": false,
"sparse": true,
"indexName": "query for user"
}
Secured by appMasterKey
Headers
- X-LC-Id: required(appId)
- X-LC-Sign: required(string)
请参考「更安全的鉴权方式」来提供 sign, https://leancloud.cn/docs/rest_api.html#hash-1794863242
Example:
e074720658078c898aa0d4b1b82bdf4b,1453014943466,master
HTTP status code 401
如果鉴权失败会返回 401 错误。
get /indices/{className}
Find and query indices
通过应用的 MasterKey 鉴权
URI Parameters
- className: required(string)
Query Parameters
- where: (string)
A URL encoded json string of query conditions to find leaderboards, please refer to storage API for more query examples.
Example:
{ "version": { "$gte": 5 } }
- skip: (integer - default: 0)
- limit: (integer - default: 100)
HTTP status code 200
Body
Media type: application/json
Type: object
Example:
{
"results" : [ {
"v" : 2,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "ayers-test.Post"
}, {
"v" : 2,
"key" : {
"updatedAt" : 1
},
"name" : "updatedAt",
"ns" : "ayers-test.Post",
"sparse" : true
}, {
"v" : 2,
"key" : {
"createdAt" : 1
},
"name" : "createdAt",
"ns" : "ayers-test.Post",
"sparse" : true
}
]
}
Secured by appMasterKey
Headers
- X-LC-Id: required(appId)
- X-LC-Sign: required(string)
请参考「更安全的鉴权方式」来提供 sign, https://leancloud.cn/docs/rest_api.html#hash-1794863242
Example:
e074720658078c898aa0d4b1b82bdf4b,1453014943466,master
HTTP status code 401
如果鉴权失败会返回 401 错误。
delete a index with specified name.
delete /indices/{className}/{indexName}
delete a index with specified name.
通过应用的 MasterKey 鉴权
URI Parameters
- className: required(string)
- indexName: required(string)
Secured by appMasterKey
Headers
- X-LC-Id: required(appId)
- X-LC-Sign: required(string)
请参考「更安全的鉴权方式」来提供 sign, https://leancloud.cn/docs/rest_api.html#hash-1794863242
Example:
e074720658078c898aa0d4b1b82bdf4b,1453014943466,master
HTTP status code 401
如果鉴权失败会返回 401 错误。