Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

POST {url}/localtrac/location/<location_uuid>/allSchedules

This route will add/update the schedule for each provided day of each provided schedule type

Request

Headers

Authorization

<token> obtained during the Authentication

Accept

application/json

Content-Type

application/json

Body (Example)

Bloc de code
languagejson
{
  "schedules": [
    {
      "schedule": {
        "sunday": [
          {
            "start": "00:00",
            "end": "24:00"
          }
        ],
        "saturday": [
          {
            "start": "00:00",
            "end": "24:00"
          }
        ]
      },
      "scheduleType": null
    },
    {
      "schedule": {
        "thursday": [
          {
            "start": "00:00",
            "end": "24:00"
          }
        ]
      },
      "scheduleType": "cc9396e6-c979-4359-bf47-2ab8a2084d54"
    }
  ]
}

Schedule (optional)

An associative array where each key is one day of the week. The value of each key is a range of opening hours with “start” and “end” key for each period within a day. The sub array allows multiple values since a day can be opened and closed multiple times per day.

  • If the key “scheduleType” has a null value, then this schedule will be applied the location’s regular opening hours.

  • If there is no key provided for a specific day of week, this means there won’t be any action performed (data in LOCALTRAC will remain unchanged)

  • If nothing is provide for a day, this means the day is closed

    Bloc de code
        {
          "schedule": {
            "thursday": []
    	  },
          "scheduleType": null
        }
  • If array with “start: null” and “end: null” is provided, this means the day is closed

    Bloc de code
        {
          "schedule": {
            "thursday": [
              {
                "start": null,
                "end": null
              }
            ]
    	  },
          "scheduleType": null
        }
  • If “start: HH:ii” and “end: HH:ii” is provided, this interval will be considered open. Multiple interval can be provided.

    Bloc de code
        "schedule": {
            "thursday": [
                    {
                      "start": "08:00",
                      "end": "12:00"
                    },
                    {
                      "start": "13:00",
                      "end": "23:00"
                    }
                ]
    	  },
          "scheduleType": "cc9396e6-c979-4359-bf47-2ab8a2084d54"
        }
  • If no keys are provided, the schedule will be deleted. (Not applicable to regular schedule when "scheduleType" is null. All days will be closed for the regular schedule.)

    Bloc de code
        {
          "schedule": {},
          "scheduleType": "c7871a5a-a651-4a05-8b07-74a42b4548ef"
        }
  • The list of available “uuid” for the “scheduleType” can be obtained from the route "GET {url}/localtrac/schedules" https://publipage.atlassian.net/wiki/spaces/LTRAC/pages/1117618201/Schedules+Schedule+Exception#GET-%7Burl%7D%2Flocaltrac%2Fschedules . See the description of the route below.

Response (200) - Success

Headers

Content-type

application/json

Cache-Control

no-cache,private

Body

Bloc de code
languagejson
{
  "schedules": "Schedules updated"
}

Response (400) - Validation Error

Headers

Content-type

application/json

Cache-Control

no-cache,private

Body

Bloc de code
languagejson
{
  "message": "Provided data contains error(s). See each entry in [errors]",
  "errors": {
    "schedules.1.schedule.thursday.0.start": "Start hour cannot be higher than end hour"
  }
}

message

Always the same message of error, indicating that an error happened during the validation process

errors

An associative array where the key represents the logical path to the data in error and the value represents the error found with the given data.

If a key contains “.” character, this means nested array. In the case of an array without keys, the logical number would be taken.

...