You need to sign in to do that
Don't have an account?
Charles Kelly 17
Trying insert records via REST API POST request. Json File.
Hello,
I'm trying to insert the below json into a custom object named Player. I need to change the field names from amateur to amater__c and country to country__c etc. How can I do this at scale?
Also, it works if I insert one record at a time but gives the error below when there is multiple records trying to be inserted.
Thank you
I'm trying to insert the below json into a custom object named Player. I need to change the field names from amateur to amater__c and country to country__c etc. How can I do this at scale?
Also, it works if I insert one record at a time but gives the error below when there is multiple records trying to be inserted.
Thank you
To change the field names in your JSON at scale, you can use a programming language like Python or JavaScript to iterate through your JSON data and modify the field names. Here's an example using Python: This code will iterate through each record in your JSON data and create a transformed record with the modified field names. You can add more field name mappings inside the transform_json function as needed.
As for the error you're encountering when trying to insert multiple records, it would be helpful if you could provide more details or the specific error message you're seeing. That way, I can assist you in resolving the issue more effectively.
For more information, you can check this: azure admin training (https://www.igmguru.com/cloud-computing/microsoft-azure-administrator-az-103-certification-training/)
Do I put this code into the "pre-request script" tab?
[
{
"amateur__c": 0,
"country__c": "England",
"country_code__c": "ENG",
"dg_id__c": 14794,
"name": "Abbott, Jamie"
},
{
"amateur__c": 1,
"country__c": "Sweden",
"country_code__c": "SWE",
"dg_id__c": 23950,
"name": "Aberg, Ludvig"
}
]
returns an error of:
[
{
"message": "Json Deserialization failed on token 'null' and has left off in the middle of parsing a row. Will go to end of row to begin parsing the next row",
"errorCode": "INVALID_FIELD"
}
]
Notice: I've changed all the field names to match SF so I don't know why it says "Invalid Field"...If I were to remove the second record and the [] then it works fine:
{
"amateur__c": 0,
"country__c": "England",
"country_code__c": "ENG",
"dg_id__c": 14794,
"name": "Abbott, Jamie"
}
Thank you!