Create Order Period

Create an order period for a business.

Parameters
  • dataformData, objectRequired

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

    • typestringRequired

      Provide Order Period type. Current selection is only order_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.

    • 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/order_periods

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

  const data = await res.json();
}

RESPONSE

{
  "data": {
    "id": "19d71aa7-6bbe-4dda-8f6f-16bddeaf26f1",
    "type": "order-periods",
    "links": {
      "self": "/order-periods/19d71aa7-6bbe-4dda-8f6f-16bddeaf26f1"
    },
    "attributes": {
      "opened-from": 1200,
      "opened-to": 5600,
      "weekday": 0
    },
    "relationships": {
      "business": {
        "links": {
          "self": "/order-periods/19d71aa7-6bbe-4dda-8f6f-16bddeaf26f1/relationships/business",
          "related": "/order-periods/19d71aa7-6bbe-4dda-8f6f-16bddeaf26f1/business"
        }
      }
    }
  }
}

Update Order Period

Update Order Period.

Parameters
  • idpath integerRequired

    Update a Order Period by specific id.

  • dataformData, objectRequired

    Form Data needed when updating a Order Period.

    • idstringRequired

      Provide Order Period id.

    • typestringRequired

      Provide Order Period type. Current selection is only open_periods.

    • attributesformData, object

      Attributes object.

      • 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/order_periods/{id}

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

  const data = await res.json();
}

RESPONSE

{
  "data": {
    "id": "19d71aa7-6bbe-4dda-8f6f-16bddeaf26f1",
    "type": "order-periods",
    "links": {
      "self": "/order-periods/19d71aa7-6bbe-4dda-8f6f-16bddeaf26f1"
    },
    "attributes": {
      "opened-from": 3600,
      "opened-to": 5600,
      "weekday": 0
    },
    "relationships": {
      "business": {
        "links": {
          "self": "/order-periods/19d71aa7-6bbe-4dda-8f6f-16bddeaf26f1/relationships/business",
          "related": "/order-periods/19d71aa7-6bbe-4dda-8f6f-16bddeaf26f1/business"
        }
      }
    }
  }
}

Delete Order Period

Delete an Order Period.

Parameters
  • idpath integerRequired

    Delete a Order Period by specific id.

DELETE/api/v1/order_periods/{id}

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