T
Twenty7mo ago
wayne

Create Field

export async function main(twenty_api_key: string, campaign_name: string) {
const url = 'https://api.twenty.com/rest/metadata/fields';
const options = {
method: 'POST',
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${twenty_api_key}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"type": "TEXT",
"name": "campaign_name",
})
};
const response = await fetch(url, options);
return await response.text()
}
export async function main(twenty_api_key: string, campaign_name: string) {
const url = 'https://api.twenty.com/rest/metadata/fields';
const options = {
method: 'POST',
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${twenty_api_key}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"type": "TEXT",
"name": "campaign_name",
})
};
const response = await fetch(url, options);
return await response.text()
}
response {"statusCode":400,"message":"Unknown type "CreateOneFieldInput". Did you mean "CreateFieldInput", "DeleteOneFieldInput", "CreateOneObjectInput", "CreateObjectInput", or "UpdateFieldInput"?","error":"Bad Request"}
2 Replies
wayne
wayneOP7mo ago
how do you create a field using the API? I am trying to find some examples
Want results from more Discord servers?
Add your server