Skip to main content

UI States API

Get all states

To get all the states for a user, send a GET request

/api/ui/states.

The result is a list of name-value pairs.

Request:

GET ui/states

Successful response:

Status: 200 OK
Content-Type: application/json
Body:
[
{
"name": "initCreativeTableColumns",
"value": "{blah}"
},
{
"name": "publishButton",
"value": "{\"show\":\"true\"}"
},
{
"name": "ratecards",
"value": "{\"rowsToDisplay\":10}"
},
...

Create or update state

A state is created or updated by sending a PUT request 

/api/ui/states/:name

The RequestBody contains both name and value.

No assumptions are made on the semantics of the value; just a string is stored.

The new state or changes are only visible to the currently logged-in user.

Request:

PUT /api/ui/states/initCreativeTableColumns
Body:
{
"name": "initCreativeTableColumns",
"value": "blah"
}

Successful response:

Status: 204 NO CONTENT

Retrieve state

A state, either a default or a state previously stored for that user, can be retrieved by sending a GET request 

/api/ui/states/:name
where :name is the unique identifier for the state.

Request:

GET /api/ui/states/initCreativeTableColumns

Successful response:

Status: 200
{
"name": "initCreativeTableColumns",
"value": "blah"
}

Unsuccessful response:

Status: 404 (state was not found) 

Missing Functionality

At the moment, it is not yet possible to update the defaults stored in table user_level_preferences.