Widgets

Return Widget for current token.

Parameters
  • includequery string

    Include associations (delimited with comma). Available associations: business

GET/api/v1/widgets/me

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

  const data = await res.json();
}

RESPONSE


Widgets by id

Return a Widget.

Parameters
  • idpath integerRequired

    Return a Widget by specific id.

  • includequery string

    Include associations (delimited with comma). Available associations: business

GET/api/v1/widgets/{id}

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

  const data = await res.json();
}

RESPONSE


Request Object

The required Request Object.

REQUEST OBJECT

{
  "data": {
    "type": "widgets",
    "attributes": {
      "domains": ["domainOne"],
      "settings": ""
    },
    "relationships": {
      "business": {
        "id": "62a05bd2-2f0e-4bac-8f8b-63947f4df16f",
        "type": "business"
      }
    }
  }
}

Create Widget

Create a widget of a business.

Parameters
  • dataformData, objectRequired

    Form Data needed when creating a new widget of a business.

    • typestringRequired

      Provide Widget type. Current selection is only widgets.

    • attributesformData, objectRequired

      Attributes object.

      • domainsstring[]Required

        Provide multiple values, atleast one is required.

      • settingsundefined

        Price in cents (currency taken from the business)

    • relationshipsformData, objectRequired

      Relationships object with business object.

      • businessformData, objectRequired

        Add a Business relationships link.

        • idstringRequired

          Related Business id.

        • typestringRequired

          Business type; business.

POST/api/v1/widgets

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

  const data = await res.json();
}

RESPONSE


Update Widget

Update a Widget

Parameters
  • idpath integerRequired

    Update a Widget by specific id.

  • dataformData, objectRequired

    Form Data needed when updating a Widget.

    • idstringRequired

      Provide Widget id.

    • typestringRequired

      Provide Widget type. Current selection is only widgets.

    • attributesformData, object

      Attributes object.

      • domainsstring[]Required

        Provide multiple values, atleast one is required.

      • settingsundefined

        Price in cents (currency taken from the business)

PATCH/api/v1/widgets/{id}

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

  const data = await res.json();
}

RESPONSE


Delete Widget

Delete a Widget.

Parameters
  • idpath integerRequired

    Delete a Widget by specific id.

DELETE/api/v1/widgets/{id}

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