Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

lock/Unlock request

This request is used to lock schedules to the system. To do it, API uses application/xml as its acceptable request representation, and the standard HTTP-method POST.

URL: /rest/2/distribution-api/schedules/lock

         /rest/2/distribution-api/schedules/unlock


Input for lock/Unlock request

The list of all supported attributes and their description provided in the table below.

#

Attribute name

Type

Style

Mandatory

Description

1dateStringQueryYesDate when the run is scheduled. Depends on the configuration for particular account localization. Example of English format is “DD/MM/YYYY”. Example of Russian format is “DD.MM.YYYY”
2vehicleIDLongQueryYesID of the vehicle in Maxoptra
3aocIDLongQueryYesID of the distribution center in Maxoptra
4runNumber

Short

Query

No

ID of run for particular vehicle in Maxoptra

The following combinations of attributes are possible for run locking/unlocking:

  1. Locking of one run: vehicleID + date + runNumber
  2. Locking for the selected vehicle: vehicleID + date
  3. Locking for the depot: aocID + date

Note 

  • The vehicle attribute (= vehicle's external ID) can be used instead of vehicleID (= vehicle's internal ID)
  • Locking/unlocking is possible only if the details have not been sent yet. When trying to lock/unlock the started run - error 1314.
  • When using the aocID attribute together with vehicleID, then all the runs for all the vehicles of the specified depot (AOC) will be locked/unlocked (if details were not sent yet). 
  • It is possible to put multiple vehicles or dates in one request.


Example of getScheduleByVehicleOnDate request

URL: /rest/2/distribution-api/schedules/{lock|unlock}?date=18.10.2018&{vehicleID=123|aocID=123}&(runNumber=1)

Method: POST


getVehicleLocationByVehicleId response


Lock schedule

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<apiResponse version="1.0">
    <runLockUnlockResponse>
        <status>LOCK_SUCCESSFUL</status>
    </runLockUnlockResponse>
</apiResponse>


Unlock schedule

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<apiResponse version="1.0">
    <runLockUnlockResponse>
        <status>UNLOCK_SUCCESSFUL</status>
    </runLockUnlockResponse>
</apiResponse>


Possible errors

Error

Description

1014Expected parameters
1015Internal service error
1019User with provided credentials doesn’t have AoC access or AoC doesn’t exist
1314Failed to lock/unlock