Create Open Period

Create an open period for a business.

Parameters
  • dataformData, objectRequired

    Form Data needed when creating an open period for a business.

    • typestringRequired

      Provide Open Period type. Current selection is only open_periods.

    • attributesformData, objectRequired

      Attributes object.

      • opened_fromstringRequired

        Date should be formated as a ISO date.

      • opened_tostringRequired

        Date should be formated as a ISO date.

      • weekdaystringRequired

        What day of week.

      • locationstring

        Location of the business.

    • relationshipsformData, object

      Relationships object with business object.

      • businessformData, object

        Add a relationships link between Open Period and related Business.

        • idstring

          Related Business id.

        • typestring

          Business type; business.

POST/api/v1/open_periods

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

  const data = await res.json();
}

RESPONSE

{
  "data": {
    "id": "c7c5fe95-445e-49cb-8a2a-09c069ca2d59",
    "type": "open-periods",
    "links": {
      "self": "/open-periods/c7c5fe95-445e-49cb-8a2a-09c069ca2d59"
    },
    "attributes": {
      "location": null,
      "opened-from": 1200,
      "opened-to": 5600,
      "weekday": 0
    },
    "relationships": {
      "business": {
        "links": {
          "self": "/open-periods/c7c5fe95-445e-49cb-8a2a-09c069ca2d59/relationships/business",
          "related": "/open-periods/c7c5fe95-445e-49cb-8a2a-09c069ca2d59/business"
        }
      }
    }
  }
}

Update Open Period

Update open period.

Parameters
  • idpath integerRequired

    Update a Open Period by specific id.

  • dataformData, objectRequired

    Form Data needed when updating a Open Period.

    • idstringRequired

      Provide Open Period id.

    • typestringRequired

      Provide Open Period type. Current selection is only open_periods.

    • attributesformData, object

      Attributes object.

      • locationstring

        Location of the business.

      • opened_fromstring

        Date should be formated as a ISO date.

      • opened_tostring

        Date should be formated as a ISO date.

      • weekdaystring

        What day of week.

PATCH/api/v1/open_periods/{id}

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

  const data = await res.json();
}

RESPONSE

{
  "data": {
    "id": "c7c5fe95-445e-49cb-8a2a-09c069ca2d59",
    "type": "open-periods",
    "links": {
      "self": "/open-periods/c7c5fe95-445e-49cb-8a2a-09c069ca2d59"
    },
    "attributes": {
      "location": null,
      "opened-from": 3600,
      "opened-to": 5600,
      "weekday": 0
    },
    "relationships": {
      "business": {
        "links": {
          "self": "/open-periods/c7c5fe95-445e-49cb-8a2a-09c069ca2d59/relationships/business",
          "related": "/open-periods/c7c5fe95-445e-49cb-8a2a-09c069ca2d59/business"
        }
      }
    }
  }
}

Delete Open Period

Delete an Open Period.

Parameters
  • idpath integerRequired

    Delete a Open Period by specific id.

DELETE/api/v1/open_periods/{id}

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