Supply Task


List All Active Supply Tasks

List Details of Specific Supply Task

Add New Supply Task

Modify Details of Specific Supply Task

Approve a Supply Task Offer


§List All Active Supply Tasks

curl --location --request GET '<API_URL>/supply/' \ --header 'X-Organization: <ORG_ID>' \ --header 'X-Twin: <TWIN_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>' { "data": [ { "type": "tasks", "id": "<TASK_ID>", "attributes": { "created": "<TIMESTAMP OF DATE CREATED>", "modified": "<TIMESTAMP OF DATE LAST MODIFIED>", "available-from": <TIMESTAMP OF DATE AVAILABLE FROM>, "available-to": <TIMESTAMP OF DATE AVAILABLE TO>, "price": <TASK_PRICE>, "latitude": "<LATITUDE>", "longitude": "<LONGITUDE>", "location-description": "<DESCRIPTION OF LOCATION>", "status": null, "marketplace": {}, "faas-obj": { … }, "faas-id": "<FAAS_TASK_ID>", "faas-profile": "<SELLER_NAME>" }, "relationships": { "twin": { "data": { "type": "twins", "id": "<TWIN_ID>" } } } } {...}, … ] }

§List Details of Specific Supply Task

curl --location --request GET '<API_URL>/supply/<TASK_ID>/' \ --header 'X-Organization: <ORG_ID>' \ --header 'X-Twin: <TWIN_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>' { "data": { "type": "tasks", "id": "<TASK_ID>", "attributes": { "created": "<ATTRIBUTE VALUE>", "modified": "<ATTRIBUTE VALUE>", "available-from": <ATTRIBUTE VALUE>, "available-to": <ATTRIBUTE VALUE>, "price": <ATTRIBUTE VALUE>, "latitude": "<ATTRIBUTE VALUE>", "longitude": "<ATTRIBUTE VALUE>", "location-description": "<ATTRIBUTE VALUE>", "status": null, "marketplace": {}, "faas-obj": { "id": <FAAS_TASK_ID>, "role": "seller", "task": "Register", "price": <ATTRIBUTE VALUE>, "sender": "<SELLER_NAME>", "target": "<BUYER_NAME>", "options": [ { "id": <FAAS_REQUEST_TASK_ID>, "task": <FAAS_TASK_ID>, "sender": "<SENDER_NAME>", "payload": { "task": "CreateOffer", "price": <ATTRIBUTE VALUE>, "domain": "Parking", "handler": "CreateOffer", "payload": { "price": <ATTRIBUTE VALUE>, "car_size": "<ATTRIBUTE VALUE>", "available_to": <ATTRIBUTE VALUE>, "available_from": <ATTRIBUTE VALUE> }, "location": "<SRID>", "protocol": "GuidedSearch", "recipient": "<BUYER_NAME>", "dialogue_id": "<DIALOGUE_ID>", "available_by": <ATTRIBUTE VALUE>, "sender_task_id": <FAAS_TASK_ID>, "target_task_id": <FAAS_TARGET_TASK_ID> }, "actioned": false, "approval": false } ], "profile": 15, "location": "<SRID>", "protocol": "GuidedSearch", "context_data": { "data": { "price": <ATTRIBUTE VALUE>, "car_size": "<ATTRIBUTE VALUE>", "available_to": <ATTRIBUTE VALUE>, "available_from": <ATTRIBUTE VALUE> }, "uuid": "<UUID>", "order": "Parking", "offers": [], "search": "Parking", "status": "AWAITING APP RESPONSE", "handler": "Search", "accepted": false, "protocol": "GuidedSearch", "recipient": null, "sent_offers": [], "order_details": [ { "id": <FAAS_TASK_ID>, "name": "<BUYER_NAME>", "event": "requesting app guidance ##cfp", "status": "AWAITING APP RESPONSE", "handler": "cfp" } ] }, "associated_dialogues": [ "<DIALOGUE_ID>" ] }, "faas-id": "<FAAS_TASK_ID>", "faas-profile": "<SELLER_NAME>" }, "relationships": { "twin": { "data": { "type": "twins", "id": "<TWIN_ID>" } } } } }

§Add New Supply Task

curl --location --request POST '<API_URL>/supply/' \ --header 'X-Organization: <ORG_ID>' \ --header 'X-Twin: <TWIN_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>' --data-raw '{"data": {"type": "tasks", "attributes": {"available_from": <ATTRIBUTE VALUE>, "available_to": <ATTRIBUTE VALUE>, "price": <ATTRIBUTE VALUE>, "latitude": <ATTRIBUTE VALUE>, "longitude": <ATTRIBUTE VALUE>, "location_description": "<ATTRIBUTE VALUE>", "marketplace": {<ATTRIBUTE>: <ATTRIBUTE VALUE>, …,}}}}' { "data": { "type": "tasks", "id": "<TASK_ID>", "attributes": { "available-from": <ATTRIBUTE VALUE>, "available-to": <ATTRIBUTE VALUE>, "price": <ATTRIBUTE VALUE>, "latitude": "<ATTRIBUTE VALUE>", "longitude": "<ATTRIBUTE VALUE>", "location-description": "<ATTRIBUTE VALUE>", "status": "", "marketplace": {} } } }

§Modify Details of Specific Supply Task

curl --location --request POST '<API_URL>/supply/<TASK_ID>' \ --header 'X-Organization: <ORG_ID>' \ --header 'X-Twin: <TWIN_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>' --data-raw '{"data": {"type": "tasks", "attributes": {"available_from": <ATTRIBUTE VALUE>, "available_to": <ATTRIBUTE VALUE>, "price": <ATTRIBUTE VALUE>, "latitude": <ATTRIBUTE VALUE>, "longitude": <ATTRIBUTE VALUE>, "location_description": "<ATTRIBUTE VALUE>", "marketplace": {<ATTRIBUTE>: <ATTRIBUTE VALUE>, …,}}}}' { "data": { "type": "tasks", "id": "<TASK_ID>", "attributes": { "created": "<TIMESTAMP OF DATE CREATED>", "modified": "<TIMESTAMP OF DATE CREATED>", "available-from": <TIMESTAMP OF DATE CREATED>, "available-to": <TIMESTAMP OF DATE CREATED>, "price": <TIMESTAMP OF DATE CREATED>, "latitude": "<TIMESTAMP OF DATE CREATED>", "longitude": "<TIMESTAMP OF DATE CREATED>", "location-description": "<TIMESTAMP OF DATE CREATED>e", "status": null, "marketplace": {}, "faas-obj": { …}, "associated_dialogues": [] }, "faas-id": "<TIMESTAMP OF DATE CREATED>", "faas-profile": "<TIMESTAMP OF DATE CREATED>" }, "relationships": { "twin": { "data": { "type": "twins", "id": "<TIMESTAMP OF DATE CREATED>" } } } } }

The “marketplace” field is an undefined json object where one can define attributes relevant to a specific marketplace. For example, in the parking example, we can define “search_radius” and “car_size” in this field for use in the task search.

This gives freedom to a developer to define what fields need to be specified in a task to perform actions on their developed marketplace.

§Approve a Supply Task Offer

curl --location --request POST '<API_URL>/supply/<TASK_ID>/approve/' \ --header 'X-Organization: <ORG_ID>' \ --header 'X-Twin: <TWIN_ID>' \ --header 'Authorization: Token <ACCESS_TOKEN>' --data-raw {"data": {"type":"tasks", "attributes": {"task": <FAAS TASK ID>, "id": <FAAS TASK ID YOU WANT TO ACCEPT AN OFFER FROM>}}} { "data": { "status_code": 200, } }