Save work-session assignments
Set who is working on what, and let BuildingSwell work out the difference.
assignments is keyed by person id, and each value is the full list of deliverables that person should be on. The call compares that against their currently open sessions: it starts sessions for deliverables you added and stops sessions for ones you dropped. A person marked absent gets a saved plan instead of a live session.
curl --request POST \
--url https://{instance}/api/v2/deliverable/work-sessions/save \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"assignments": {
"3fa85f64-5717-4562-b3fc-2c963f66afa6": [
"6f1d7c40-1f8e-4a1e-9f7b-2c963f66afa6"
]
},
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"shouldStopEntireBatch": true
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
assignments: {
'3fa85f64-5717-4562-b3fc-2c963f66afa6': ['6f1d7c40-1f8e-4a1e-9f7b-2c963f66afa6']
},
shopId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
startDate: '2023-11-07T05:31:56Z',
shouldStopEntireBatch: true
})
};
fetch('https://{instance}/api/v2/deliverable/work-sessions/save', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{instance}/api/v2/deliverable/work-sessions/save"
payload = {
"assignments": { "3fa85f64-5717-4562-b3fc-2c963f66afa6": ["6f1d7c40-1f8e-4a1e-9f7b-2c963f66afa6"] },
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"shouldStopEntireBatch": True
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}Authorizations
Organization-scoped API key. Create one in the BuildingSwell app under Organization settings, API keys.
Body
Keyed by person id. Each value is that person's full list of deliverable ids, with at least one entry.
Show child attributes
Show child attributes
{
"3fa85f64-5717-4562-b3fc-2c963f66afa6": ["6f1d7c40-1f8e-4a1e-9f7b-2c963f66afa6"]
}
Department the sessions belong to.
When the sessions start. Defaults to now.
Set this to stop the person's whole current batch rather than restarting the sessions you left in place.
Response
Saved. The response has no body.
curl --request POST \
--url https://{instance}/api/v2/deliverable/work-sessions/save \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"assignments": {
"3fa85f64-5717-4562-b3fc-2c963f66afa6": [
"6f1d7c40-1f8e-4a1e-9f7b-2c963f66afa6"
]
},
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"shouldStopEntireBatch": true
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
assignments: {
'3fa85f64-5717-4562-b3fc-2c963f66afa6': ['6f1d7c40-1f8e-4a1e-9f7b-2c963f66afa6']
},
shopId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
startDate: '2023-11-07T05:31:56Z',
shouldStopEntireBatch: true
})
};
fetch('https://{instance}/api/v2/deliverable/work-sessions/save', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{instance}/api/v2/deliverable/work-sessions/save"
payload = {
"assignments": { "3fa85f64-5717-4562-b3fc-2c963f66afa6": ["6f1d7c40-1f8e-4a1e-9f7b-2c963f66afa6"] },
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"shouldStopEntireBatch": True
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}{
"error": {
"message": "<string>",
"code": "BAD_REQUEST",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>",
"code": "<string>"
}
],
"missingPermissions": [
"<string>"
]
},
"context": {}
}