Hi!
I've already used ok some api requsts recently, then I needed to change url for another host + request, but got 404.
- in browser i got 401 for just url (see code), because no auth header its ok and its not 404 as I got in simulators.
- curl:
curl -H "Host: www.ukrposhta.ua" -H "Authorization: Bearer c3e02b53-3b1d-386e-b676-141ffa054c57" --compressed "https://www.ukrposhta.ua/status-tracking/0.0.1/statuses?barcode=0501698463278"
gives 200 and json (array of objects).
but in Connect IQ it just says 404 in the end in onReceive method.
Any ideas why ?
function makeRequest() { var url = "https://ukrposhta.ua/status-tracking/0.0.1/statuses?barcode=0501695505620"; var options = { :method => Comm.HTTP_REQUEST_METHOD_GET, :headers => { "Content-Type" => Comm.REQUEST_CONTENT_TYPE_JSON, "User-Agent" => "UkrPoshta/1 CFNetwork/1107.1 Darwin/19.0.0", "Authorization" => "Bearer c3e02b53-3b1d-386e-b676-141ffa054c57" } }; if (Comm has :makeWebRequest) { // in modern watches its executed Comm.makeWebRequest(url, null, options, method(:onReceive)); } else { Comm.makeJsonRequest(url, null, options, method(:onReceive)); } } function onReceive(responseCode, data) { var code = responseCode; }
Any ideas why ?
I even tried to use parameter barcode in as separate variable for request
var url = "https://www.ukrposhta.ua/status-tracking/0.0.1/statuses";
and
var params = { "barcode" => "0501698463278"};
same 404
curl -H "Host: www.ukrposhta.ua" -H "Authorization: Bearer XXXXX" --compressed "https://www.server.com"