Update a PCO’s Custom Attributes
This tutorial demonstrates how to update a PCO’s custom attributes.
Before You Begin
- Register an app
- Acquire a 3-legged OAuth token with
data:read
anddata:write
scopes. - Verify that you have access to the relevant BIM 360 account and BIM 360 project.
- Have the project’s
projectId
,accountId
, and appropriatecontainerId
for the contract. /en/docs/bim360/v1/tutorials/retrieve-cost-container-id/ describes how to retrieve them. - Create PCOs and add custom attributes in the BIM 360 Project Admin module. See the `Help documentation <https://help.autodesk.com/view/BIM360D/ENU/?guid=BIM360D_Cost_Management_about_cost_management_html> for more information.
Step 1: Get a PCO in BIM 360 Cost Management
Find the ID of the PCO you want to update by calling GET change-orders/:changeOrder. In this example, assume that the container ID is e94b9bc8-1775-4d76-9b1d-c613e120ccff
. Add the include=attributes
query string parameter to include the custom attributes in the response.
Request
curl 'https://developer.api.autodesk.com/cost/v1/containers/e94b9bc8-1775-4d76-9b1d-c613e120ccff/change-orders/pco?limit=100&offset=0&include=attributes' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0'
Response
{
"results": [{
"id": "1a53c5c0-61b6-11e8-b4c8-f7f2ad363daa",
"number": "0001",
"name": "Revised Entrance Layout",
"scope": "out",
"type": "",
"description": "",
"note": "",
"...": "...",
"createdAt": "2018-05-27T13:58:58.844Z",
"updatedAt": "2018-12-26T05:40:42.665Z",
"properties": [{
"name": "Revised Substantial Completion",
"value": "2020-6-1",
"propertyDefinitionId": "9240df60-61b5-11e8-9d14-7f96380922a0",
"...": "...",
}]
}],
"pagination": {
"totalResults": 1,
"limit": 100,
"offset": 0
}
}
Note the PCO ID (results[0].id
) in the first part of the response - 55254a50-44d9-11e9-99d7-79aa05d3109e
, and the custom attribute definition ID (9240df60-61b5-11e8-9d14-7f96380922a0
).
Step 2: Update the Custom Attribute Value
Use the container ID (e94b9bc8-1775-4d76-9b1d-c613e120ccff
), PCO ID (55254a50-44d9-11e9-99d7-79aa05d3109e
), and custom attribute definition ID (9240df60-61b5-11e8-9d14-7f96380922a0
) to call POST property-values:batch-update to update the custom attribute value.
Request
curl -v 'https://developer.api.autodesk.com/cost/v1/containers/e94b9bc8-1775-4d76-9b1d-c613e120ccff/property-values:batch-update' -X 'POST' -H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a' -H 'Content-Type: application/json' \
-d '[{associationId: "55254a50-44d9-11e9-99d7-79aa05d3109e", associationType: "FormInstance", propertyDefinitionId: "9240df60-61b5-11e8-9d14-7f96380922a0", value: "2020-06-16T16:00:00.000Z"}]'
For change orders including PCOs, the associationType
is FormInstance
, and the PCO ID is associationId
. For other modules, the associationType
is the module name, for example, Budget
, or Contract
, and the associationId
is always the empty UUID 00000000-0000-0000-0000-000000000000
.
Response
You get the full content of the updated custom attribute value.
[{
"name": "Revised Substantial Completion",
"value": "2020-06-16T16:00:00.000Z",
"propertyDefinitionId": "9240df60-61b5-11e8-9d14-7f96380922a0",
"...": "...",
}]
Multiple custom attributes can be updated altogether.
Congratulations! You have successfully updated the PCO’s custom attribute value.