Update a work session
Change one work session. Only the fields you send are touched.
curl --request PATCH \
--url https://{instance}/api/v2/deliverable/work-sessions/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"deliverableId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"isEdited": false,
"lastUpdatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shiftWorkHours": {
"startTime": "08:00",
"endTime": "17:00",
"breaks": [
{
"startTime": "12:00",
"durationInSec": 1800
}
],
"timezone": "America/New_York"
},
"externalSource": "<string>",
"externalSync": "synced",
"metadata": {
"costCode": "WELD-100",
"unionCode": "LOCAL-7"
}
}
'const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
deliverableId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
workerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
shopId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
isEdited: false,
lastUpdatedBy: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
shiftWorkHours: {
startTime: '08:00',
endTime: '17:00',
breaks: [{startTime: '12:00', durationInSec: 1800}],
timezone: 'America/New_York'
},
externalSource: '<string>',
externalSync: 'synced',
metadata: {costCode: 'WELD-100', unionCode: 'LOCAL-7'}
})
};
fetch('https://{instance}/api/v2/deliverable/work-sessions/{id}', 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/{id}"
payload = {
"deliverableId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"isEdited": False,
"lastUpdatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shiftWorkHours": {
"startTime": "08:00",
"endTime": "17:00",
"breaks": [
{
"startTime": "12:00",
"durationInSec": 1800
}
],
"timezone": "America/New_York"
},
"externalSource": "<string>",
"externalSync": "synced",
"metadata": {
"costCode": "WELD-100",
"unionCode": "LOCAL-7"
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"value": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"deliverableId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"isEdited": false,
"lastUpdatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shiftWorkHours": {
"startTime": "08:00",
"endTime": "17:00",
"breaks": [
{
"startTime": "12:00",
"durationInSec": 1800
}
],
"timezone": "America/New_York"
},
"breakTimeInSec": 123,
"externalSource": "<string>",
"externalSync": "synced",
"metadata": {
"costCode": "WELD-100",
"unionCode": "LOCAL-7"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"rawStart": "2023-11-07T05:31:56Z",
"rawEnd": "2023-11-07T05:31:56Z"
}
}{
"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.
Path Parameters
Record id.
Body
Every field is optional. Only the fields you send are changed.
Deliverable the time was logged against.
Person who did the work.
Department the session belongs to.
When the session started, in UTC.
When the session ended, in UTC. null means it is still open.
true when someone has edited the session by hand.
Who last changed the session.
The shift the record was worked against. Break times are local wall-clock, not UTC.
Show child attributes
Show child attributes
System the session came from, for example quickbase.
Sync state for the external system.
"synced"
Free-form key-value store. No key is guaranteed to be present, and a missing key is not the same as a null one. See the resource guide for which paths populate costCode and unionCode.
{ "costCode": "WELD-100", "unionCode": "LOCAL-7" }
Response
The updated work session.
Time one person logged against one deliverable. An open session has no endDate.
Show child attributes
Show child attributes
curl --request PATCH \
--url https://{instance}/api/v2/deliverable/work-sessions/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"deliverableId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"isEdited": false,
"lastUpdatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shiftWorkHours": {
"startTime": "08:00",
"endTime": "17:00",
"breaks": [
{
"startTime": "12:00",
"durationInSec": 1800
}
],
"timezone": "America/New_York"
},
"externalSource": "<string>",
"externalSync": "synced",
"metadata": {
"costCode": "WELD-100",
"unionCode": "LOCAL-7"
}
}
'const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
deliverableId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
workerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
shopId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
isEdited: false,
lastUpdatedBy: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
shiftWorkHours: {
startTime: '08:00',
endTime: '17:00',
breaks: [{startTime: '12:00', durationInSec: 1800}],
timezone: 'America/New_York'
},
externalSource: '<string>',
externalSync: 'synced',
metadata: {costCode: 'WELD-100', unionCode: 'LOCAL-7'}
})
};
fetch('https://{instance}/api/v2/deliverable/work-sessions/{id}', 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/{id}"
payload = {
"deliverableId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"isEdited": False,
"lastUpdatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shiftWorkHours": {
"startTime": "08:00",
"endTime": "17:00",
"breaks": [
{
"startTime": "12:00",
"durationInSec": 1800
}
],
"timezone": "America/New_York"
},
"externalSource": "<string>",
"externalSync": "synced",
"metadata": {
"costCode": "WELD-100",
"unionCode": "LOCAL-7"
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"value": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"deliverableId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shopId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"isEdited": false,
"lastUpdatedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"shiftWorkHours": {
"startTime": "08:00",
"endTime": "17:00",
"breaks": [
{
"startTime": "12:00",
"durationInSec": 1800
}
],
"timezone": "America/New_York"
},
"breakTimeInSec": 123,
"externalSource": "<string>",
"externalSync": "synced",
"metadata": {
"costCode": "WELD-100",
"unionCode": "LOCAL-7"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"rawStart": "2023-11-07T05:31:56Z",
"rawEnd": "2023-11-07T05:31:56Z"
}
}{
"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": {}
}