...
To create a new object. On success, the method always returns the internal object id of the newly created objectParameters:
{
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
{
"attrs":{list of attribute value pairs}
} |
...
...
...
"result":{"id":the id of the newly created object} |
...
Examples:
Method:/user/create
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
...
...
...
...
...
...
| Code Block |
|---|
|
{
"error":0,
"result":{"id": |
...
...
Method:/usertoken/createParameters:
{
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
{
"attrs": |
...
...
"user id",
"product.id":"product id"
}
} |
| Code Block |
|---|
|
{
"error":0,
"result":{"id": |
...
| Anchor |
|---|
| _Toc341972292 |
|---|
| _Toc341972292 |
|---|
|
/
| Anchor |
|---|
| _Toc315972316 |
|---|
| _Toc315972316 |
|---|
|
object/delete
To delete an object. The request parameter MUST be the internal id of the object to be deleted. On success the method returns error 0.
Parameters: {"id":the id of the object to be deleted}
Response: {"error":0}
Example:
Method:/user/deleteParameters: {
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
{
"id": |
...
...
| Anchor |
|---|
| _Toc341972293 |
|---|
| _Toc341972293 |
|---|
|
/
| Anchor |
|---|
| _Toc315972317 |
|---|
| _Toc315972317 |
|---|
|
object/get
...
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
{
"match":
[
["id","=",10"userid"]
],
"return":["name","email","phone"]
} |
...
To set the object's attributes. The request must provide a list of attributes and values that are to be set. On success the method returns error 0.Parameters:
{
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
{
"id":"the id of the object to be edited", |
...
"attrs":{list of attribute pairs}
} |
...
...
Example:
Method:/user/set
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
...
...
...
...
...
...
| Anchor |
|---|
| _Toc341972295 |
|---|
| _Toc341972295 |
|---|
|
/
| Anchor |
|---|
| _Toc315972319 |
|---|
| _Toc315972319 |
|---|
|
object/search
...
- the name of the attribute
- the operator
- the value to be matched
...
For
...
example:
...
["id","=",
...
2
...
]
...
Matching
...
operators
...
supported:
...
String operators:
| Operator | Function |
|---|
| = | equals to |
| >> | starts with |
| << | ends with |
| ~= | like |
| like | like |
| Code Block |
|---|
|
{
"match":[
operators:
= equals to
like like
examples:
\["firstName","=", "john"\]
\,
["email","like", "j%acme.com"\]
]
} |
Integer operators:
| Operator | Function |
|---|
| = | equals to |
| >= | greater than or equals to |
| <= | less than or equals to |
| > | greater than |
| < | less than |
| Code Block |
|---|
|
{
"match":[
["failCount",">", "3"]
]
} |
Date operators:
| Operator | Function |
|---|
| = | equals to |
| > | after |
| < | before |
| Code Block |
|---|
|
{
"match":[
["lastChangePassword", "<", "2019 operators:
= equals to
< less than
> greater than
examples:
\["age","=", 45\]
\["weight","<", 110\]
\["size",">", 42\]
Date operators:
= equals to
< before
> after
examples:
\["lastModified","=", "2009-08-20T00:00:00Z"\]
\["created","<", "2009-01-12T12:00:00Z"\]
\["deleted",">", "2008-08-21T08:00:00Z"\]
Notes: all date value should be in ISO 8601 format.
Parameters:
\{
"match":\{ ]
} |
Notes: all date value should be in ISO 8601 format.
Request parameters and response:
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
{
"match": [list of attributes to be matched\}]
"return":\[array of attributes to be returned\]
"sort": attribute to be sorted by
"order":"asc" | "desc"
"max": the maximum numbers of records to return
"offset": the offset
\}
Response: \{} |
| Code Block |
|---|
|
{
"error": 0,
"result":\[array of list of attributes\objects]\
}
+Example+
|
Example:
Method:/user/search
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
{
Parameters:
\{
"match":
\ [
\["domain.id", "=", 2\"domain id"],
\ ["lastnamelastName", "=", "smith"\],
\ ["email", "like~=", "[%@acme.com|mailto:%25@acme.com]"\],
\ ],
"return":\["firstnamefirstName", "lastnamelastName", "email", "phonetelephone"\],
"sort":"lastnamelastName",
"order":"asc",
"max": 20,
"offset": 10
\}
Response:
\} |
| Code Block |
|---|
|
{
"error": 0,
"result":
\ {
"total": 20,
"rows":
\[
\ [
{
"firstname "firstName":"John",
"lastname "lastName":"Smith",
"email":"js@acme.com",
"phone "telephone":"447974321234",
\ },
\{
{
"firstname":"David",
"lastname":"Smith",
"email":"ds@acme.com",
"phonetelephone":"447974234975",
\}
\]
\}
\}
\\
// a failed response
\{
"error":101,
"message":"user not found"
\}
-------------------------------------------------------------------
},
...
]
}
}
|
Method:/token/search
| Code Block |
|---|
| language | js |
|---|
| title | Parameters |
|---|
|
{
Parameters:
\{
"match":
\ [
\["userproduct.id", "=", 2\]
\["category", "=", "OTP"\]
\"product id"]
],
"return":\["serial"\],
"sort":\["serial"\]
\}
Response:
\{
",
"order":"asc",
"max": 20,
"offset": 10
} |
| Code Block |
|---|
|
{
"error": 0,
"result":
\ {
"total":4 20,
"rows":
\ [
\ {"serial":"77004155"\},
\ {"serial":"77004245"\},
\ {"serial":"77004266"\},
\ {"serial":"77004321"\},
\]
\}
\}
\\
...
]
}
}
|