I am writing a serverless app that will correct some of the records if not set. Specifically, onAccountCreate or onContactCreate, if country is set, use that value to set the territory and time zone.
The problem I am having is that there are some required fields which I do not have a value for. I want to set some of the fields w/o setting the required fields.
Here is my REST API call:
curl --location --request PUT 'https://***.myfreshworks.com/crm/sales/api/sales_accounts/16003120437' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token token=***' \
--data-raw '{
"sales_account": {
"website": "https://www.pksi.com/",
"territory_id": 16000000266,
"owner_id": 16000031274,
"custom_field": {
"cf_region": "APAC",
"cf_country": "India"
}
}
}'
But industry_type_id and cf_business_type are required fields so I get an 400 error back because required field omitted.
I also tried to set them to null as follows:
curl --location --request PUT 'https://***.myfreshworks.com/crm/sales/api/sales_accounts/16003120437' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token token=***' \
--data-raw '{
"sales_account": {
"website": "https://www.pksi.com/",
"territory_id": 16000000266,
"owner_id": 16000031274,
"industry_type_id": null,
"cf_business_type": null,
"custom_field": {
"cf_region": "APAC",
"cf_country": "India"
}
}
}'
So still I get 400 error / missing required field.
Is there any way to set some fields in REST API w/o updating requried fields that are currently unset?