Hi!
I’m trying to update my company records using GSID in the endpoint as the key, but then when I include the gsid in the payload I get an error saying that it can’t be updated:
Failed to update a batch of 50 records in Gainsight: {"result":false,"errorCode":"GSOBJ_1010","errorDesc":"Immutable fields such as Gsid cannot be changed. Please re-check your request.","localizedErrorDesc":null,"requestId":"4b28d446-0435-4abf-b94a-e91d82cd4f61","data":null,"message":"gsid cannot be modified since it is an immutable field.","localizedMessage":null}
But in the documentation it says if a field is a key then it isn’t updated. When I tried to match on Name it ended up creating a brand new set of records instead of matching, even though the record names were exactly the same. Here is my request (I’m using Hex). Any help would be appreciated!
post_url = "https://vertice.eu.gainsightcloud.com/v1/data/objects/Company?keys=GSID"
gainsight_headers = {
'content-type': 'application/json',
'accesskey': gainsight_api_key
}
def update_gainsight_companies(batch_data):
data_payload = {
"records": batch_data
}
response = requests.post(post_url, headers=gainsight_headers, data=json.dumps(data_payload))
if response.status_code == 200:
print(f"Successfully updated a batch of {len(batch_data)} records in Gainsight.")
else:
print(f"Failed to update a batch of {len(batch_data)} records in Gainsight: {response.text}")
def batch_update_gainsight(missed_spend_df):
chunk_size = 50
num_chunks = len(missed_spend_df) // chunk_size + (1 if len(missed_spend_df) % chunk_size else 0)
for i in range(num_chunks):
batch = missed_spend_df.ilocsi*chunk_size:(i+1)*chunk_size]
batch_data = b
{
"Gsid": rowe'gsid'],
"company_account_id__gc": row_'account_id'],
"SaaS_Missed_Spend__gc": rowe'total_account']
}
for index, row in batch.iterrows()
]
update_gainsight_companies(batch_data)
#if hex_scheduled:
batch_update_gainsight(missed_spend)