Link a Budget to a Contract (deprecated)
- The workflow described in this tutorial is deprecated and will not be supported after October 15, 2024.
- We have introduced a new endpoint for batch linking and unlinking budgets to contracts. For more information, see Link Budgets to Contracts (new).
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.
- Retrieve the project container ID for your project as described in Retrieve container id.
- Ensure that you have created or imported a couple of budgets and a contract in your project.
Step 1: Find a Contract in BIM 360 Cost Management
Find the ID of the contract you want to update by calling GET Contracts. In this example, assume that the project container ID is 18ece8b1-204d-11e8-ad71-d73b169f902a
.
Request
curl 'https://developer.api.autodesk.com/cost/v1/containers/18ece8b1-204d-11e8-ad71-d73b169f902a/contracts?limit=100&offset=0' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0'
Response
{
"results": [{
"id": "55254a50-44d9-11e9-99d7-79aa05d3109e",
"name": "Substructure",
"...":"...",
}],
"pagination": {
"totalResults": 1,
"limit": 100,
"offset": 0
}
}
In this example, the contract ID is in the first part of the response (results[0].id
). It’s 55254a50-44d9-11e9-99d7-79aa05d3109e
. You’ll use it in a later step.
Step 2: Find the Budgets in BIM 360 Cost Management
Find the IDs of the budgets you want to link to the contract by calling GET Budgets. In this example, assume again that the container ID is 18ece8b1-204d-11e8-ad71-d73b169f902a
.
Request
curl 'https://developer.api.autodesk.com/cost/v1/containers/18ece8b1-204d-11e8-ad71-d73b169f902a/budgets?limit=100&offset=0' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0'
Response
{
"results": [{
"id": "5573e292-4355-4d00-a204-2cba97b7025a",
"...":"...",
},
{
"id": "f7840135-dd11-45d2-9b54-b0887ab3c29b",
"...":"...",
}
],
"pagination": {
"totalResults": 2,
"limit": 100,
"offset": 0
}
}
In this example, the budget IDs are in the first part of the response (results[0].id
). They’re 5573e292-4355-4d00-a204-2cba97b7025a
and f7840135-dd11-45d2-9b54-b0887ab3c29b
. You’ll use them in the next step.
Step 3: Update the Contract
Use the container ID (18ece8b1-204d-11e8-ad71-d73b169f902a
), contract ID(55254a50-44d9-11e9-99d7-79aa05d3109e
) noted above to call PATCH contracts/:contractId to update the contract.
Request
curl -v 'https://developer.api.autodesk.com/cost/v1/containers/18ece8b1-204d-11e8-ad71-d73b169f902a/contracts/55254a50-44d9-11e9-99d7-79aa05d3109e' -X 'PATCH' -H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a' -H 'Content-Type: application/json' \
-d '{"budgets": [{"id": "5573e292-4355-4d00-a204-2cba97b7025a", {"id": "f7840135-dd11-45d2-9b54-b0887ab3c29b"}]}'
Response
The endpoint returns the full content of the updated contract.
{
"id": "55254a50-44d9-11e9-99d7-79aa05d3109e",
"code": "GC-01",
"name": "Site Management Staff",
"description": "Site Management Staff",
"companyId": "764893",
"type": "consultant",
"budgets": [{
"id": "5573e292-4355-4d00-a204-2cba97b7025a",
"code": "11BD-222-33",
"name": "substructure",
"...": "..."
},
{
"id": "f7840135-dd11-45d2-9b54-b0887ab3c29b",
"code": "11BD-222-34",
"name": "structure",
"...": "..."
}
],
"...": "..."
}
Congratulations! The budgets and contract are linked. All changes in the budgets will now show up in the contract.