TwentyT
Twenty15mo ago
4 replies
Denis

Restful API: Metafield creation with options in it issue.

Hello,

I am trying to create a metafield inside the crm via restful api with all the countries but, I dont seem to find the correct way to create the json to populate the field with the options.


the current json body looks like this:
{
"type": "SELECT",
"name": "country",
"label": "Country",
"description": "A field to select a country.",
"icon": "IconWorld",
"isNullable": true,
"objectMetadataId": "{{$randomUUID}}",
"options": [
{
"id": "{{$randomUUID}}",
"color": "orange",
"label": "Afghanistan",
"value": "AFGHANISTAN",
"position": 0
},
{
"id": "{{$randomUUID}}",
"color": "pink",
"label": "Aland Islands",
"value": "ALAND ISLANDS",
"position": 1
}
]
}

but, the response I get is:
{
"statusCode": 400,
"messages": [
"Bad Request Exception"
],
"error": "Bad Request"
}

any clue why?
Was this page helpful?