hi, why i can't insert record using
hi, why i can't insert record using fetch?
function test() {
const payload = {
wallet_id: "string"
};
const options = {
method: 'POST',
headers: {
Authorization: 'Bearer key',
'Content-Type': 'application/json'
},
body: payload
};
try {
const response = UrlFetchApp.fetch('linklink', options);
Logger.log(response.getContentText());
} catch (e) {
Logger.log("Error: " + e.message);
}
}
and after null
![No description](https://cdn.answeroverflow.com/1267859660074123264/image.png)
3 Replies
I'm wondering if it is a serialization issue. Can you try placing the payload in the body directly along the lines:
ok, i fixed that with 'method': 'post', idk why but fixed.
So, how i can get one record where wallet_id = my value?
U know?
You would apply a filter in the body of your request such as:
And send that with a post request to the /query endpoint of your table.
You can find an example here: https://xata.io/docs/sdk/filtering#exact-matching
Switch the tab to JSON to see the raw HTTP request url endpoint and body content