Articles in this section

State API endpoints

download.svg​​ Download Postman collection

State API endpoints

Relative URI

Method

Success Code

Description

/state

GET

200

Get all global keys.

DELETE

204

Delete all global keys and values. Be careful with this API!

/state/<key>

GET

200

Get the value associated with the key.

PUT

200

Create/update the value associated with the key.

DELETE

204

Delete the key and value.

/<resource_type>/<_id>/state

GET

200

Get all keys stored underneath a specific resource in your account.

DELETE

200

Delete all keys and values stored underneath the resource. Be careful with this API!

/<resource_type>/<_id>/state/<key>

GET

200

Get the resource specific value associated with the key.

PUT

200

Create/update the resource specific value associated with the key.

DELETE

200

Delete the resource specific key and value.

State API examples

Get all keys

GET /v1/state HTTP/1.1
Host: api.integrator.io
Authorization: Bearer my_api_token

Sample response

{
    "keys":[
        "apple",
        "banana"
    ]
}

Get the value for the key "banana"

GET /v1/state/banana HTTP/1.1
Host: api.integrator.io
Authorization: Bearer my_api_token

Sample response

{
    "message":"Don't slip!"
}

Update the value for the key "banana"

PUT /v1/state/banana HTTP/1.1
Host: api.integrator.io
Authorization: Bearer my_api_token

{
    "message":"Don't slip!",
    "reply":"i didn't!"
}

Sample Response:

OK

Get the value for the key "banana" (again)

GET /v1/state/banana HTTP/1.1
Host: api.integrator.io
Authorization: Bearer my_api_token

Sample response

{
    "message":"Don't slip!",
    "reply":"i didn't!"
}

Create a value to track a sequence number for an EDI data import (that would be updated every time the import is run)

Note

This state value is stored underneath the related import resource.

PUT /v1/imports/55cc•••••••••005d/state/sequenceNumber HTTP/1.1
Host: api.integrator.io
Authorization: Bearer my_api_token

{
    "counter":1
}

Sample response

Created

Get the value just created above

GET /v1/imports/55c••••••••••005d/state/sequenceNumber HTTP/1.1
Host: api.integrator.io
Authorization: Bearer my_api_token

Sample response

{
    "counter":1
}

Get all keys (again)

Note

The key stored underneath the import (that we just created above) was not returned. Only global keys are returned by the top level GET /state API. To return all keys underneath a specific resource, use the more specific state API for that resource. For example, GET /imports/55c•••••••••••05d/state

GET /v1/state HTTP/1.1
Host: api.integrator.io
Authorization: Bearer my_api_token
GET /v1/imports/55c•••••••••••••05d/state HTTP/1.1
Host: api.integrator.io
Authorization: Bearer my_api_token

Sample response

{
    "keys":[
        "apple",
        "banana"
    ]
}

Sample response

{
    "keys":[
        "sequenceNumber"
    ]
}
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.