Chinese Documentation : Installation REST API

All of the endpoints in the table below are inherited from PersistedModel REST API, except for the following:

Quick reference

URI Pattern

 

HTTP VerbDefault PermissionDescriptionArguments

/Installations/byApp

 

GET

 

Find installations by app ID

Query parameters:

  • deviceType
  • appID
  • appVersion

/Installations/byUser

 

GET

 

Find installations by user ID

Query parameters:

  • deviceType
  • userId

/Installations 

 

POST 

Add installation instance and persist to data source. Inherited from generic model API.

JSON object (in request body)
/InstallationsGET Find all instances of installations that match specified filter. Inherited from generic model API .

One or more filters in query parameters:

  • where
  • include
  • order
  • limit
  • skip / offset
  • fields
/InstallationsPUT Update / insert installation instance and persist to data source. Inherited from generic model API .JSON object (in request body)
/Installations/idGET Find installation by ID: Return data for the specified instance ID. Inherited from generic model API .id, the installation ID (in URI path)
/Installations/idPUT Update installation attributes for specified installation ID and persist. Inherited from generic model API .

Query parameters:

  • data An object containing property name/value pairs
  • id - The installation ID
/Installations/idDELETE Delete installation with specified instance ID. Inherited from generic model API .id, installation ID (in URI path)
/Installations/countGET 

Return number of installation instances that match specified where clause. Inherited from generic model API.

Query parameter: "where" filter.
/Installations/id/existsGET 

Check instance existence: Return true if specified user ID exists. Inherited from generic model API .

URI path: id installation ID

/Installations/findOneGET 

Find first installation instance that matches specified filter. Inherited from generic model API .

Same as Find matching instances.

Find installations by app ID

Return JSON array of installations of specified app ID that also match the additional specified arguments (if any).

 

GET /Installations/byApp

 

Arguments

All arguments are in query string:

  • deviceType
  • appId
  • appVersion

Example

Request: 

curl -X GET 
http://localhost:3000/Installation/byApp?appId=KrushedKandy&deviceType=ios

Response:

[
  {
    "id": "1",
    "appId": "KrushedKandy",
    "userId": "raymond",
    "deviceType": "ios",
    "deviceToken": "756244503c9f95b49d7ff82120dc193ca1e3a7cb56f60c2ef2a19241e8f33305",
    "subscriptions": [],
    "created": "2014-01-09T23:18:57.194Z",
    "modified": "2014-01-09T23:18:57.194Z"
  },
...
]

Errors

REVIEW COMMENT from $paramName
What are error codes?

Find installations by user ID

Return JSON array of installations by specified user ID that also match the additional specified argument (if provided).

 

GET /Installations/byUser

 

Arguments

Argumens are in query string:

  • deviceType
  • userId

Example

Request: 

curl -X GET 
http://localhost:3000/Installations/byUser?userId=raymond

Response:

[
  {
    "id": "1",
    "appId": "MyLoopBackApp",
    "userId": "raymond",
    "deviceType": "ios",
    "deviceToken": "756244503c9f95b49d7ff82120dc193ca1e3a7cb56f60c2ef2a19241e8f33305",
    "subscriptions": [],
    "created": "2014-01-09T23:18:57.194Z",
    "modified": "2014-01-09T23:18:57.194Z"
  }
]

Errors

REVIEW COMMENT from $paramName
What are error codes?