End User Applications Data

In some cases an application running on top of the APIO could need to store some data (application related, not user related) in APIO DB as they do not have their own DB.

The End User Applications Data APIs are offering this possibility by exposing a mechanism of key/value pairs for an application at End User level.

It must be very clear that an application must use this mechanism wisely in terms of access, for example by caching the results, in order to not overload the APIO and therefore impacts its main role.

It must also be noted that the ‘application’ itself is a virtual object: it virtual existence relies on the fact that keys exist or not for it.

Listing existing applications

GET /api/v1/tenants/(string: tenant_id)/groups/(string: group_id)/users/(string: user_id)/properties/applications/

Return the list of all the currently existing applications

Example request:

GET /api/v1/tenants/foo/groups/foogroup/users/foouser/properties/applications/ HTTP/1.1
Host: example.com
Content-Type: "application/json"

{
}

Example response:

HTTP/1.1 200 OK
Content-Type: "application/json"

{
   "applications": [
      {"applicationId": "netaxis"}
   ]
}
Response JSON Object:
  • applications (array) – The list of applications. Each of them containing an attribute ‘applicationId’.

Status Codes:

Listing existing keys of an application

GET /api/v1/tenants/(string: tenant_id)/groups/(string: group_id)/users/(string: user_id)/properties/applications/(string: applicationId)/

Return the list of all the keys of an application

Example request:

GET /api/v1/tenants/foo/groups/foogroup/users/foouser/properties/applications/netaxis/ HTTP/1.1
Host: example.com
Content-Type: "application/json"

{
}

Example response:

HTTP/1.1 200 OK
Content-Type: "application/json"

{
   "applicationKeys": [
      {"applicationId": "netaxis", "key": "coffee"},
      {"applicationId": "netaxis", "key": "beer"}
   ]
}
Response JSON Object:
  • applicationKeys (array) – The list of application objects. Each of them containing an attribute ‘applicationId’ and an attribute ‘key’.

Status Codes:

Create a new key for an application

POST /api/v1/tenants/(string: tenant_id)/groups/(string: group_id)/users/(string: user_id)/properties/applications/(string: applicationId)/

Create a new key for an application.

Example request:

POST /api/v1/tenants/foo/groups/foogroup/users/foouser/properties/applications/netaxis/ HTTP/1.1
Host: example.com
Content-Type: "application/json"

{
   "key": "coffee",
   "data": "Lavazza is great"
}
Request JSON Object:
  • key (string) – The new key to be created.

  • data (string) – The data to be saved. It can be a normal string, a base64 encoded object, a json string, or any other type as long as it encdoed as a string.

Example response:

HTTP/1.1 200 OK
Content-Type: "application/json"

{
   "applicationdId": "netaxis",
   "key": "coffee",
   "data": "Lavazza is great"
}
Response JSON Object:
  • applicationId (string) – the id of the application

  • key (string) – the key newly created

  • data (string) – the data saved.

Status Codes:
  • 200 OK – No error

  • 400 Bad Request

    Unable to create the key/value, with possible sub-error codes:

    • 11: ALREADY_EXISTS

    • 2: INVALID_PARAMETERS

Modify an existing key of an application

PUT /api/v1/tenants/(string: tenant_id)/groups/(string: group_id)/users/(string: user_id)/properties/applications/(string: applicationId)/(string: key)/

Modify an existing key of an application.

Example request:

PUT /api/v1/tenants/foo/groups/foogroup/users/foouser/properties/applications/netaxis/coffee/ HTTP/1.1
Host: example.com
Content-Type: "application/json"

{
   "data": "Starbucks is cool"
}
Request JSON Object:
  • data (string) – The data to be saved. It can be a normal string, a base64 encoded object, a json string, or any other type as long as it encoded as a string.

  • auto_create (boolean) – (Optional) if set to true (default is false) if the application key does not exist it will be created.

Example response:

HTTP/1.1 200 OK
Content-Type: "application/json"

{
   "applicationdId": "netaxis",
   "key": "coffee",
   "data": "Starbucks is cool"
}
Response JSON Object:
  • applicationId (string) – The id of the application.

  • key (string) – The key updated.

  • data (string) – The data saved.

Status Codes:
  • 200 OK – No error

  • 404 Not Found – Application or key not found

  • 400 Bad Request

    Unable to create the key/value, with possible sub-error codes:

    • 2: INVALID_PARAMETERS

Read an existing key of an application

GET /api/v1/tenants/(string: tenant_id)/groups/(string: group_id)/users/(string: user_id)/properties/applications/(string: applicationId)/(string: key)/

Read an existing string of an application.

Example request:

GET /api/v1/tenants/foo/groups/foogroup/users/foouser/properties/applications/netaxis/coffee/ HTTP/1.1
Host: example.com
Content-Type: "application/json"

{
}

Example response:

HTTP/1.1 200 OK
Content-Type: "application/json"

{
   "applicationdId": "netaxis",
   "key": "coffee",
   "data": "Starbucks is cool"
}
Response JSON Object:
  • applicationId (string) – The id of the application.

  • key (string) – The key.

  • data (string) – The data.

Status Codes:

Delete an existing key of an application

DELETE /api/v1/tenants/(string: tenant_id)/groups/(string: group_id)/users/(string: user_id)/properties/applications/(string: applicationId)/(string: key)/

Delete an existing string of an application.

Example request:

DELETE /api/v1/tenants/foo/groups/foogroup/users/foouser/properties/applications/netaxis/coffee/ HTTP/1.1
Host: example.com
Content-Type: "application/json"

{
}

Example response:

HTTP/1.1 200 OK
Content-Type: "application/json"

{
}
Status Codes:
  • 200 OK – No error. If the key does not exists, a 200 is also returned.