HomeRecipesAPI ReferenceChangelogDiscussions
Log In
Discussions

Discussions

Ask a Question
Back to All

Updating Internal Cost Status

I'm able to pull internal cost information (specifically the Internal Cost Status and it's ID).

I would like to be able to update it via the API. But I'm having some issues getting it to update. Here is my example code, let me know what I'm doing wrong or provide a sample code on how to update internal cost status.

cost_testing_url = 'https://am-ce98a.corrigo.com/api/v1/base/WorkOrderCost'

update_ic_status = {
'Entity': {
'Id': 738156,
'Items': [
{
'WoId': 738156,
'CostStatusId': 3,
'Comment': 'MES Fuel Surcharge Added via Alteryx',
'TypeId': 'Cost',
'CostCategory': 'SpotPurchase'
}
]
},
'Properties': ['Id', 'Items.Id', 'Items.*']
}

update_ic_status_request = requests.put(cost_testing_url, headers=headers, data=json.dumps(update_ic_status))

When running this I'm getting the following error:
{'ErrorMessage': 'CostCategory is a required field.',
'ErrorCode': 'ERROR_CODE_1',
'TimeStamp': '2022-07-21T22:03:28.0100979Z'}

If you could please provide sample code on how to update internal cost status, that would be great.