Create Device

Create a Device for current user.

Parameters
  • dataformData, objectRequired

    Form Data needed when creating a new Device.

    • typestringRequired

      Provide Device type. Current selection is only devices.

    • attributesformData, objectRequired

      Attributes object with a few required fields.

      • device_typestringRequired

        Device type, android or ios.

      • registration_idstringRequired

        Registration ID

POST/api/v1/devices

{
  const res = await fetch(`${BASE_URL}/api/v1/devices`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(data)});

  const data = await res.json();
}

RESPONSE

{
  "data": {
    "id": "60a1890b-2506-4bf3-89d2-f6738dfe0dbc",
    "type": "devices",
    "links": {
      "self": "/devices/60a1890b-2506-4bf3-89d2-f6738dfe0dbc"
    },
    "attributes": {
      "registration-id": "4c24148e-6a48-11ed-a1eb-0242ac120002"
    }
  }
}

Delete Device

Delete a Device.

Parameters
  • idpath integerRequired

    Delete a Device by specific Device id.

DELETE/api/v1/devices/{id}

{
  const res = await fetch(`${BASE_URL}/api/v1/devices/${id}`, {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json'
    }});
  const data = await res.json();
}