Demand Task
List Details of Specific Demand Task
Modify Details of Specific Demand Task
§List All Active Demand Tasks
curl --location --request GET '<API_URL>/demand/' \
--header 'X-Organization: <ORG_ID>' \
--header 'X-Twin: <TWIN_ID>' \
--header 'Authorization: Token <ACCESS_TOKEN>'
{
"data": [
{
"type": "tasks",
"id": "7788f9d5-934e-476e-a938-a8b3a8dbf86a",
"attributes": {
"created": "<ATTRIBUTE VALUE>",
"modified": "<ATTRIBUTE VALUE>",
"reservation-time": <ATTRIBUTE VALUE>,
"min-price": <ATTRIBUTE VALUE>,
"max-price": <ATTRIBUTE VALUE>,
"latitude": "<ATTRIBUTE VALUE>",
"longitude": "<ATTRIBUTE VALUE>",
"location-description": "<ATTRIBUTE VALUE>",
"status": "SEARCHING",
"marketplace": {},
"faas-obj": {
"id": 42,
"role": "buyer",
"task": "Search",
"price": <ATTRIBUTE VALUE>,
"sender": "Juanita Clayton",
"target": "Juanita Clayton",
"options": [],
"profile": 15,
"location": "SRID=4326;POINT (40.71308 -73.994957)",
"protocol": "GuidedSearch",
"context_data": {
"data": {
"car_size": "<ATTRIBUTE VALUE>",
"max_price": <ATTRIBUTE VALUE>,
"min_price": <ATTRIBUTE VALUE>,
"arrival_time": <ATTRIBUTE VALUE>,
"search_radius": <ATTRIBUTE VALUE>
},
"uuid": null,
"offers": [],
"search": "Parking",
"status": "SEARCHING",
"handler": "Search",
"accepted": false,
"protocol": "GuidedSearch",
"recipient": null,
"order_details": [
{
"name": "Juanita Clayton",
"event": "searching, found 0 tasks",
"status": "SEARCHING",
"handler": "Search"
}
],
"contacted_tasks": [
38,
41
]
},
"associated_dialogues": [
"d75bb430-9a4d-44d6-aa9f-cd1471fb28b3",
"1e9d458d-312c-4a13-9785-812312e5cd8a"
]
},
"faas-id": "42",
"faas-profile": "Juanita Clayton"
},
"relationships": {
"twin": {
"data": {
"type": "twins",
"id": "89e58950-0304-467c-b1e1-3d6b3f66e6e2"
}
}
}
}
]
}
§List Details of Specific Demand Task
curl --location --request GET '<API_URL>/demand/<TASK_ID>/' \
--header 'X-Organization: <ORG_ID>' \
--header 'X-Twin: <TWIN_ID>' \
--header 'Authorization: Token <ACCESS_TOKEN>'
{
"data": {
"type": "tasks",
"id": "7788f9d5-934e-476e-a938-a8b3a8dbf86a",
"attributes": {
"created": "2022-05-05T11:34:23.023328Z",
"modified": "2022-05-05T11:34:47.010662Z",
"reservation-time": 1649775684.0,
"min-price": 0.0,
"max-price": 100.0,
"latitude": "40.713080",
"longitude": "-73.994957",
"location-description": "House",
"status": "SEARCHING",
"marketplace": {},
"faas-obj": {
"id": 42,
"role": "buyer",
"task": "Search",
"price": 100.0,
"sender": "Juanita Clayton",
"target": "Juanita Clayton",
"options": [],
"profile": 15,
"location": "SRID=4326;POINT (40.71308 -73.994957)",
"protocol": "GuidedSearch",
"context_data": {
"data": {
"car_size": "SUV",
"max_price": 100.0,
"min_price": 0.0,
"arrival_time": 1649775684.0,
"search_radius": 10
},
"uuid": null,
"offers": [],
"search": "Parking",
"status": "SEARCHING",
"handler": "Search",
"accepted": false,
"protocol": "GuidedSearch",
"recipient": null,
"order_details": [
{
"name": "Juanita Clayton",
"event": "searching, found 2 tasks",
"status": "SEARCHING",
"handler": "Search"
}
],
"contacted_tasks": [
38,
41
]
},
"associated_dialogues": [
"d75bb430-9a4d-44d6-aa9f-cd1471fb28b3",
"1e9d458d-312c-4a13-9785-812312e5cd8a"
]
},
"faas-id": "42",
"faas-profile": "Juanita Clayton"
},
"relationships": {
"twin": {
"data": {
"type": "twins",
"id": "89e58950-0304-467c-b1e1-3d6b3f66e6e2"
}
}
}
}
}
§Add New Demand Task
curl --location --request POST '<API_URL>/demand/' \
--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": "7788f9d5-934e-476e-a938-a8b3a8dbf86a",
"attributes": {
"reservation-time": "1649775684",
"min-price": 0.0,
"max-price": 100.0,
"latitude": "40.713080",
"longitude": "-73.994957",
"location-description": "House",
"status": "",
"marketplace": {}
}
}
}
§Modify Details of Specific Demand Task
curl --location --request POST '<API_URL>/demand/<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": "7788f9d5-934e-476e-a938-a8b3a8dbf86a",
"attributes": {
"created": "2022-05-05T11:34:23.023328Z",
"modified": "2022-05-05T11:34:47.010662Z",
"reservation-time": 1649775684.0,
"min-price": 0.0,
"max-price": 100.0,
"latitude": "40.713080",
"longitude": "-73.994957",
"location-description": "House",
"status": "SEARCHING",
"marketplace": {},
"faas-obj": {
"id": 42,
"role": "buyer",
"task": "Search",
"price": 100.0,
"sender": "Juanita Clayton",
"target": "Juanita Clayton",
"options": [],
"profile": 15,
"location": "SRID=4326;POINT (40.71308 -73.994957)",
"protocol": "GuidedSearch",
"context_data": {
"data": {
"car_size": "SUV",
"max_price": 100.0,
"min_price": 0.0,
"arrival_time": 1649775684.0,
"search_radius": 10
},
"uuid": null,
"offers": [],
"search": "Parking",
"status": "SEARCHING",
"handler": "Search",
"accepted": false,
"protocol": "GuidedSearch",
"recipient": null,
"order_details": [
{
"name": "Juanita Clayton",
"event": "searching, found 2 tasks",
"status": "SEARCHING",
"handler": "Search"
}
],
"contacted_tasks": [
38,
41
]
},
"associated_dialogues": [
"d75bb430-9a4d-44d6-aa9f-cd1471fb28b3",
"1e9d458d-312c-4a13-9785-812312e5cd8a"
]
},
"faas-id": "42",
"faas-profile": "Juanita Clayton"
},
"relationships": {
"twin": {
"data": {
"type": "twins",
"id": "89e58950-0304-467c-b1e1-3d6b3f66e6e2"
}
}
}
}
}
§Approve a Demand Task Offer
curl --location --request POST '<API_URL>/demand/<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,
}
}