TwentyT
Twenty2y ago
wayne

Very slow response when payload incorrect

export async function main(twenty_api_key: string, data: Array) {
  const url = 'https://api.twenty.com/rest/batch/people';
  const options = {
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Authorization': `Bearer ${twenty_api_key}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(data[0])
  };
  const response = await fetch(url, options);
  return await response.text()
}


data =
[
  {
    "email": "koz@bionluk.com",
    "jobTitle": "Angel Investor",
    "lastName": "Koz",
    "firstName": "Muenif",
    "linkedinLink": {
      "url": "http://www.linkedin.com/in/munifkoz",
      "label": "LinkedIn"
    }
  }
]


As you can see, firstname and lastname are put incorrectly.

I get a 520 but it takes minutes to get back an answer
Was this page helpful?