Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To create a new object. On success, the method always returns the internal object id of the newly created objectParameters:
{

Code Block
languagejs
titleParameters
{
    "attrs":{list of attribute value pairs}
}

...


Code Block
languagejs
titleResponse

...

{

...


    "result":{"id":the id of the newly created object}

...


}


Examples:
Method:/user/create

Code Block
languagejs
titleParameters

...

{

...


    "attrs":

...


    {
        "domain.id":2,

...


         "name":"John Smith",

...


         "email":"js@acme.com"

...


    }
}


Code Block
languagejs
titleResponse
{
    "error":0,
    "result":{"id":

...

"1234567890abcd"}
}


-------------------------------------------------------------------
Method:/usertoken/create

Code Block
languagejs
titleParameters

...

{

...


    "attrs":

...


    {
        "user.id":"user id",
        "product.id":"product id"
    }
}


Code Block
languagejs
titleResponse
{
    "error":0,
    "result":{"id":

...

"1234567890abcd"}
}


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/delete

Code Block
languagejs
titleParameters

...

{
    "id":

...

"1234567890abcd"
}


Code Block
languagejs
titleResponse

...

{
    "error":0
}


Anchor
_Toc341972293
_Toc341972293
/
Anchor
_Toc315972317
_Toc315972317
object/get

...

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
languagejs
titleParameters
{
    "id":"the id of the object to be edited",

...


    "attrs":{list of attribute pairs}
}

...


Code Block
languagejs
titleResponse

...

{
    "error":0
}


Example:
Method:/user/set

Code Block
languagejs
titleParameters

...

{

...


    "id":

...

"user id",
    "attrs":

...


    {
        "name":"John Smith",

...


        "email":"js@acme.com"

...


    }
}


Code Block
languagejs
titleResponse
{
    "error":0
}

Anchor
_Toc341972295
_Toc341972295
/
Anchor
_Toc315972319
_Toc315972319
object/search

...