Hi @job - That happens because of the empty response which isn’t a valid JSON. So you should remove the z.JSON.parse line to fix this.
//...
return z.request(options).then((response) => {
response.throwForStatus();
// ---> Remove the z.JSON.parse here because the response is empty
return t];
});
Dear Ikbel @ikbelkirasan
Thanks for the quick respons , now I got a different error :-)
the total form reads :
const options = {
url: `https://start.exactonline.nl/api/v1/798621/crm/Accounts(guid'${bundle.inputData.ID}')`,
method: 'PUT',
headers: {
'Authorization': `Bearer ${bundle.authData.access_token}`
},
params: {
},
body: {
'ID': bundle.inputData.ID,
'Name': bundle.inputData.Name,
'Code': bundle.inputData.Code,
'Phone': bundle.inputData.Phone,
'Email': bundle.inputData.Email,
'Postcode': bundle.inputData.Postcode,
'City': bundle.inputData.City,
'Country': bundle.inputData.Country,
'AddressLine1': bundle.inputData.AddressLine1
}
}
//..
return z.request(options).then((response) => {
response.throwForStatus();
// ---> Remove the z.JSON.parse here because the response is empty
return c];
});
and now the error reads
Invalid API Response: - Got a non-object result, expected an object from create (undefined) What happened (You are seeing this because you are an admin): Executing creates.Update_Klant.operation.perform with bundle Invalid API Response: - Got a non-object result, expected an object from create (undefined) Console logs:
← Test Again
Finish Testing & Continue
Hi @job - My bad, it must return an object instead of an array. Try the following, it should work.
//...
return z.request(options).then((response) => {
response.throwForStatus();
return {};
});
Dear @ikbelkirasan
Thanks for the list help, can I ask you another question ?
I use an api to get info for items, if there are more then 1000 records, it throws back a direct link in the output .
I need to use that complete link in a new action , to make a new GET call , that should read :
https://start.exactonline.nl/api/v1/798621/bulk/logistics/Items?$select=Class_01,%20Class_02,%20Class_03,%20Class_04,%20Class_05,%20Class_06,%20Class_07,%20Class_08,%20Class_09,%20Class_10,%20Code,%20CostPriceNew,%20EndDate,%20GLCosts,%20GLRevenue,%20GLStock,%20ID,%20IsMakeItem,%20IsPackageItem,%20IsPurchaseItem,%20IsSalesItem,%20IsStockItem,%20IsSubcontractedItem,%20ItemGroup,%20NetWeightUnit,%20Notes,%20SearchCode,%20StartDate,%20Unit,PictureUrl,CostPriceNew,CostPriceStandard,Description,ExtraDescription,ItemGroupDescription,%20Stock&$skiptoken=guid'c845fa87-7312-432b-8494-13e1ef7bb177
but if I use this as input, zapier reads it in to an array because of the comma’s I cannot find how to use this only as text ,
my code is
const options = {
url: bundle.inputData.nest,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${bundle.authData.access_token}`
},
params: {
}
}
return z.request(options)
.then((response) => {
response.throwForStatus();
const results = z.JSON.parse(response.content);
// You can do any parsing you need for results here before returning them
return results;
});
but it pushes the url as an array
Request URL
"https://start.exactonline.nl/api/v1/798621/bulk/logistics/Items?$select=Class_01","%20Class_02","%20Class_03","%20Class_04","%20Class_05","%20Class_06","%20Class_07","%20Class_08","%20Class_09","%20Class_10","%20Code","%20CostPriceNew","%20EndDate","%20GLCosts","%20GLRevenue","%20GLStock","%20ID","%20IsMakeItem","%20IsPackageItem","%20IsPurchaseItem","%20IsSalesItem","%20IsStockItem","%20IsSubcontractedItem","%20ItemGroup","%20NetWeightUnit","%20Notes","%20SearchCode","%20StartDate","%20Unit","PictureUrl","CostPriceNew","CostPriceStandard","Description","ExtraDescription","ItemGroupDescription","%20Stock&$skiptoken=guid'c845fa87-7312-432b-8494-13e1ef7bb177"]
any thoughts ?
@ikbelkirasan never mind, if I push it from a different zap it works , just not in de developer mode