Back

Sending data to appwrite cloud function.

  • 0
  • Functions
Axistro
24 Aug, 2024, 06:36

i am trying to send data to a cloud function but cant figure out how. i saw to stringify the data, and did, but still cannot use the data i sent. accordding to the function , if data is missing , show a 400 error code. and in the function log , i can see that. So i assume my data is not sent correctly or recived correctly. can anyone provide a code snippet if you were able to send and recive data to cloud function?

TL;DR
Developers having trouble sending data to a cloud function should stringify the data when sending. If missing data triggers a 400 error code, verify that the data is being sent/received correctly. Here's a sample code snippet for sending and receiving data to a cloud function: ``` // Sample code snippet for sending data to a cloud function const dataToSend = { key: 'value' }; const requestData = JSON.stringify(dataToSend); // Make the API call to the cloud function with the requestData fetch('cloudFunctionEndpoint', { method: 'POST', body: requestData }) .then(response => response.json())
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more