Represents a Work Order Attachment in SOFT4Spaces. A work order attachment is a file attached to an existing work order, e.g. a photo or a document. On the Work Order Card, the files are shown in the Attachments.
Note
For information about enabling APIs for Business Central see Overview.
API endpoint
| API | Path |
| woAttachment | businesscentralPrefix/ |
Methods
| Method | Return Type | Description |
| GET woAttachments | woAttachment | Gets work order attachment objects. |
| GET woAttachment | woAttachment | Gets a work order attachment object. |
| POST woAttachment | woAttachment | Creates a work order attachment object. |
GET woAttachments
Description
Retrieves existing work order attachment records from Business Central.
HTTP Request
GET
https://{{businesscentralPrefix}}/
Request Headers
| Header | Value |
| Authorization | Bearer {token}. Required. |
| Accept | application/ |
Request Body
None.
Response
Returns a 200 OK status code and JSON object representing the work order attachment records.
Example Response
JSON
|
{ "value": [ { "id": "c3a1f2e4-5b6d-f111-a820-7ced8d4a3899", "parentId": "b463d714-de4a-f111-a820-7ced8d4a3899", "fileName": "Burst pipe photo", "fileExtension": "jpg", "attachmentContent": "" } ] } |
GET woAttachment
Description
Retrieves an existing work order attachment record from Business Central.
HTTP Request
GET
https://{{businesscentralPrefix}}/
Request Headers
| Header | Value |
| Authorization | Bearer {token}. Required. |
| Accept | application/ |
Request Body
None.
Response
Returns a 200 OK status code and JSON object representing the work order attachment record.
Example Response
JSON
|
{ "id": "c3a1f2e4-5b6d-f111-a820-7ced8d4a3899", "parentId": "b463d714-de4a-f111-a820-7ced8d4a3899", "fileName": "Burst pipe photo", "fileExtension": "jpg", "attachmentContent": "" } |
POST woAttachment
Description
Creates a new work order attachment in Business Central and attaches the file to the work order.
HTTP Request
POST
https://{{businesscentralPrefix}}/
Request Headers
| Header | Value |
| Authorization | Bearer {token}. Required. |
| Accept | application/ |
Request Body
Provide a JSON object with the work order id, the file name, the file extension and the file content encoded in Base64.
JSON
|
{ "parentId": "b463d714-de4a-f111-a820-7ced8d4a3899", "fileName": "Burst pipe photo", "fileExtension": "jpg", "attachmentContent": "/9j/4AAQSkZJRgABAQEASABIAAD..." } |
Response
Returns a 201 Created status code and the created work order attachment object.
Properties
| Property | Type | Description |
| id | GUID | The unique ID of the work order attachment. Non-editable. |
| parentId | GUID | Specifies the id of the work order to which the file is attached (the id from workOrders, not the work order number). The work order has to exist. Required when creating an attachment. |
| fileName | string | Specifies the file name without the extension. Required when creating an attachment. |
| fileExtension | string | Specifies the file extension, e.g. pdf, jpg, xlsx. |
| attachmentContent | string | Specifies the file content encoded in Base64. Used when creating an attachment. |
JSON Representation
|
{ "id": "GUID", "parentId": "GUID", "fileName": "string", "fileExtension": "string", "attachmentContent": "string" } |