T
Twenty3mo ago
James

Create custom objects via metadata API

Hi, been trying to do this today. Struggling to find the correct mutation and input type. Is there any documentation around or can anyone provide an example query please?
8 Replies
Prastoin
Prastoin3mo ago
Hello @James , you can access your graphql api playground through your workspace settings page Also you can use extensions such as https://chromewebstore.google.com/detail/graphql-network-inspector/ndlbedplllcgconngcnfmkadhokfaaln in order to have a more human readable look to the cloud networks tabs ( allow easier query/mutation copy and vars copy too )
Prastoin
Prastoin3mo ago
HItting plus after selecting add mutation
No description
Prastoin
Prastoin3mo ago
Selecting create one object in order to build your mutation from the UI api playground directly
No description
James
JamesOP3mo ago
Thanks for this. I was able to successfully create a custom object using this with just the mandatory input fields. However, when I try to run the exact same query using curl (with Authorization: Bearer <API_KEY> and Content-Type: application/json), I get the following error: {"errors":[{"message":"Unknown argument "input" on field "Mutation.createOneObject".","locations":[{"line":1,"column":40}]}]} It seems curl is rejecting the input argument, even though the Playground accepts it. Any ideas why there's this discrepancy or what I might be doing wrong with curl? Thanks!
Prastoin
Prastoin3mo ago
I would recommend hitting the REST api instead of the graphql one when using CURL You can also have access to the REST api playground within your workspace settings
James
JamesOP3mo ago
Great thanks - when creating a script to programmatically create multiple custom objects, any advice? Just getting errors at the moment
Prastoin
Prastoin3mo ago
Not really unfortunately. You will be able to import and export twenty configurations by the end of Q3 ( allowing metadatas sync )
James
JamesOP3mo ago
Ok great - thanks!

Did you find this page helpful?