Page 1 of 1

Json api curl

Posted: Tue Nov 26, 2019 3:28 pm
by Thomas seewald
Hello, I'm always looking for a programmer. I also like to pay for this service. Please have a look at my code.
The first part ("if 1 is 2 then") works fine.
The curl string also works in the terminal.

I guess the problem is the assembly of the Json part.
If you have an idea write me with your asking price to
ts Oduodu . de
Thank you. I'll take care of it.

This is working in terminal
curl -v -X POST -u userpassword -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-Billbee-Api-Key: mykey' -d '{ "Sku": "1000774", "NewQuantity": 2, "ForceSendStockToShops": false }' 'thisurl'

on mouseup
if 1 is 2 then

put "curl -v -X POST -u user:password -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-Billbee-Api-Key:mykey' -d '{ ''Sku'': ''1000774'', ''NewQuantity'': 3, ''ForceSendStockToShops'': false }' 'thisurl' " into zusenden

replace "''" with quote in zusenden
put shell(zusenden) into inhalt
put the result into xp
end if

put "Authorization: Basic" && base64Encode("user:password") into tHeader
put cr&"Accept: application/json" after tHeader
put cr&"X-Billbee-Api-Key: my code" after tHeader
set the httpHeaders to tHeader

put "{ 'Sku': '1000774', 'NewQuantity': 2, 'ForceSendStockToShops': false }" into zusenden ----> I think there is the mistake
replace "'" with quote in zusenden

post zusenden to url "thisurl"
put the result into xp
put libUrlLastRhHeaders() into xx
put it into inhalt
end mouseup

inhalt --> {"ErrorMessage":"Parameter SKU is empty","ErrorCode":11,"Data":null}
xp --> tsneterr: HTTP response code 400 returned from server