I am having trouble posting data gotten from a get request to the inbox url of my project. I am using opensheet. The Github link to the project is GitHub - benborgers/opensheet: đź’ľ An API to get a Google Sheet as JSON, no authentication required. an open source API that converts rows of data in Google Sheets to JSON. The JSON data can be gotten from a single link as long as the spreadsheet is public. Here is the link to the public spreadsheet.
I am using the language-http adaptor with Openfn credentials only since the Google Sheets link is public. Below are my GET and POST requests.
get("<link to the opensheet link above", {
headers: {"content-type": "application/json"},
},
function(state) {
console.log(state.data);
return state;
}
)
post("<inbox-url id", {
body: state => {
console.log(state)
return {
"Customer Name": dataValue('key'),
"Phone Number": dataValue('key'),
"Gender": dataValue('key'),
"Date Of Birth": dataValue('key')
};
},
headers: {“content-type”: “application/json”},
},
function(state){
console.log(state);
return state;
}
)
Upon checking my activity history, I find that both requests succeed but the post request brings an empty object despite the GET request fetching the data. The GET request actually brings the arrays of objects from the console.log(state.data) .
Here is the console.log(state) response.
The message body also returns an empty JSON message.
Any ideas on solving this?