Skip to content

Suggestions

GET Suggestions for event

Side effects

This request has side effects! By adding current_state=new you are making sure the suggestions you are receiving are totally up to date with the plan status and you are cancelling all the outdated suggestions.

curl 'https://{root_url}/bucket-planning/v2/suggestions/?event_id=fdf306da-f771-4b92-92ea-00e1005b6719&current_state=new' \
  -H 'apikey: {YOUR_API_KEY}'
{
    "count": 3,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": "33bf73cb-bdf6-4d79-9c8f-6ffc83d4304b",
            "algorithm_fields": {},
            "timeslot": [
                "2017-11-13T07:30:00Z",
                "2017-11-13T12:00:00Z"
            ],
            "timeslot_id": null,
            "created": "2019-08-26T08:07:29.712Z",
            "modified": "2019-08-26T08:07:29.712Z",
            "current_state": "new",
            "old_state": "empty",
            "state_reason": null,
            "cost": 6.001,
            "price": null,
            "event": "fdf306da-f771-4b92-92ea-00e1005b6719",
            "bucket_id": "c7e5ec8c-3ab8-41b6-b91b-0a215ed25321"
        },
        {
            "id": "da312d2b-58e7-4601-a551-edb81a3deb3e",
            "algorithm_fields": {},
            "timeslot": [
                "2017-11-13T17:30:00Z",
                "2017-11-13T22:00:00Z"
            ],
            "timeslot_id": null,
            "created": "2019-08-26T08:07:29.721Z",
            "modified": "2019-08-26T08:07:29.721Z",
            "current_state": "new",
            "old_state": "empty",
            "state_reason": null,
            "cost": 94.759,
            "price": null,
            "event": "fdf306da-f771-4b92-92ea-00e1005b6719",
            "bucket_id": "c7e5ec8c-3ab8-41b6-b91b-0a215ed25321"
        },
        {
            "id": "4b1a9d47-e885-4aa3-88a7-6c139e539a4f",
            "algorithm_fields": {},
            "timeslot": [
                "2017-11-13T12:00:00Z",
                "2017-11-13T17:30:00Z"
            ],
            "timeslot_id": null,
            "created": "2019-08-26T08:07:29.716Z",
            "modified": "2019-08-26T08:07:29.716Z",
            "current_state": "new",
            "old_state": "empty",
            "state_reason": null,
            "cost": 66.504,
            "price": null,
            "event": "fdf306da-f771-4b92-92ea-00e1005b6719",
            "bucket_id": "c7e5ec8c-3ab8-41b6-b91b-0a215ed25321"
        }
    ]
}

Available query params

Name format Description Example
event_id GUID Filter by event id event_id=fdf306da-f771-4b92-92ea-00e1005b6719
bucket_id GUID Filter by bucket id bucket_id=f5034f06-c9e4-4c01-b732-201bbf5a352d
current_state Enum Filter by suggestion current state current_state=initialized
old_state Enum Filter by suggestion old state current_state=initialized
limit Integer Sets the maximum amount of results the request answer is going to contain limit=2
offset Integer Sets the initial index from which the results are going to be returned. offset=10

GET all available Suggestions

curl https://{root_url}/bucket-planning/v2/suggestions/?limit=2 \
  -H 'apikey: {YOUR_API_KEY}'
{
    "count": 30,
    "next": "https://{root_url}/bucket-planning/v2/suggestions/?limit=2&offset=2",
    "previous": null,
    "results": [
        {
            "id": "33bf73cb-bdf6-4d79-9c8f-6ffc83d4304b",
            "algorithm_fields": {},
            "timeslot": [
                "2017-11-13T07:30:00Z",
                "2017-11-13T12:00:00Z"
            ],
            "timeslot_id": null,
            "created": "2019-08-26T08:07:29.712Z",
            "modified": "2019-08-26T08:07:29.712Z",
            "current_state": "new",
            "old_state": "empty",
            "state_reason": null,
            "cost": 6.001,
            "price": null,
            "event": "fdf306da-f771-4b92-92ea-00e1005b6719",
            "bucket_id": "c7e5ec8c-3ab8-41b6-b91b-0a215ed25321"
        },
        {
            "id": "da312d2b-58e7-4601-a551-edb81a3deb3e",
            "algorithm_fields": {},
            "timeslot": [
                "2017-11-13T17:30:00Z",
                "2017-11-13T22:00:00Z"
            ],
            "timeslot_id": null,
            "created": "2019-08-26T08:07:29.721Z",
            "modified": "2019-08-26T08:07:29.721Z",
            "current_state": "new",
            "old_state": "empty",
            "state_reason": null,
            "cost": 94.759,
            "price": null,
            "event": "fdf306da-f771-4b92-92ea-00e1005b6719",
            "bucket_id": "c7e5ec8c-3ab8-41b6-b91b-0a215ed25321"
        }
    ]
}

APPROVE/DECLINE a suggestion

Tip

The available actions are: approve and decline

curl https://{root_url}/bucket-planning/v2/suggestions/33bf73cb-bdf6-4d79-9c8f-6ffc83d4304b/actions/ \
  -H 'Content-Type: application/json' \
  -H 'apikey: {YOUR_API_KEY}' \
  -d '{"action": "approve"}'
{
    "id": "33bf73cb-bdf6-4d79-9c8f-6ffc83d4304b",
    "timeslot": [
        "2017-10-02T17:00:00Z",
        "2017-10-02T18:00:00Z"
    ],
    "timeslot_id": null,
    "current_state": "approved",
    "cost": "0",
    "price": "0.00",
    "event": "123123123-2d91-4e93-b7d1-215422c41bf3",
    "bucket_id": "c7e5ec8c-3ab8-41b6-b91b-0a215ed25321"
    }

GET Suggestions for event with timeslot windows

Timeslot Windows

If timeslot_windows is not provided, bucket timeslot_windows will be used as default.

curl -X GET 'https://{root_url}/bucket-planning/v2/suggestions/?event_id=fdf306da-f771-4b92-92ea-00e1005b6719&current_state=new' \
  -H 'apikey: {YOUR_API_KEY}' \
  -d '
  {
    "timeslot_windows": [
        {
            "min_time": "2019-07-23T04:00:00Z",
            "max_time": "2019-07-23T05:30:00Z",
            "id": "6291f587-800d-4114-b3c9-9bddb08d9650",
        },
        {
            "min_time": "2019-07-23T05:30:00Z",
            "max_time": "2019-07-23T10:00:00Z",
            "id": "6291f587-800d-4114-b3c9-9bddb08d9651",
        },
        {
            "min_time": "2019-07-23T04:00:00Z",
            "max_time": "2019-07-23T10:00:00Z",
            "id": "6291f587-800d-4114-b3c9-9bddb08d9652",
        }
    ]
  }'
{
    "count": 3,
    "next": null,
    "previous": null,
    "results": [
        {
          "id": "20198cac-284a-4384-aaa8-4cc74c23aaf9",
          "algorithm_fields": {},
          "timeslot": [
            "2019-07-23T04:00:00Z",
            "2019-07-23T05:30:00Z"
          ],
          "timeslot_id": "6291f587-800d-4114-b3c9-9bddb08d9650",
          "cost": 1.662,
          "price": null,
          "event": "fdf306da-f771-4b92-92ea-00e1005b6719",
          "bucket_id": "a03ee56d-0021-4890-8321-00ef6f990414",
          "current_state": "new",
          "old_state": "empty",
          "state_reason": null,
          "created": "2019-07-22T10:16:15Z",
          "modified": "2019-07-22T10:16:16Z"
        },
        {
          "id": "20198cac-284a-4384-aaa8-4cc74c23aaf8",
          "algorithm_fields": {},
          "timeslot": [
            "2019-07-23T05:30:00Z",
            "2019-07-23T10:00:00Z"
          ],
          "timeslot_id": "6291f587-800d-4114-b3c9-9bddb08d9651",
          "cost": 1.662,
          "price": null,
          "event": "fdf306da-f771-4b92-92ea-00e1005b6719",
          "bucket_id": "a03ee56d-0021-4890-8321-00ef6f990414",
          "current_state": "new",
          "old_state": "empty",
          "state_reason": null,
          "created": "2019-07-22T10:16:15Z",
          "modified": "2019-07-22T10:16:16Z"
        },
        {
          "id": "38c1b276-2be0-408c-a56c-ec141cbe8cf0",
          "algorithm_fields": {},
          "timeslot": [
            "2019-07-23T04:00:00Z",
            "2019-07-23T10:00:00Z"
          ],
          "timeslot_id": "6291f587-800d-4114-b3c9-9bddb08d9652",
          "cost": 1.662,
          "price": null,
          "event": "fdf306da-f771-4b92-92ea-00e1005b6719",
          "bucket_id": "a03ee56d-0021-4890-8321-00ef6f990414",
          "current_state": "new",
          "old_state": "empty",
          "state_reason": null,
          "created": "2019-07-22T10:16:15Z",
          "modified": "2019-07-22T10:16:16Z"
        }
    ]
}

Available query params

Name format Description Example
event_id GUID Filter by event id event_id=fdf306da-f771-4b92-92ea-00e1005b6719
bucket_id GUID Filter by bucket id bucket_id=f5034f06-c9e4-4c01-b732-201bbf5a352d
current_state Enum Filter by suggestion current state current_state=initialized
old_state Enum Filter by suggestion old state current_state=initialized
limit Integer Sets the maximum amount of results the request answer is going to contain limit=2
offset Integer Sets the initial index from which the results are going to be returned. offset=10