Good morning guys,
Does anyone have a test API call I can make to test out if my response call works.
Good morning guys,
Does anyone have a test API call I can make to test out if my response call works.
I have tried setting up my own test, but all I can get is a 404 code.
Can someone else please try making a HTTP_GET to this address http://sailing-racer.herokuapp.com/api/dummy
No data or params are needed.
200 response code, and a text message?
Trying to figure out if this is a web development issue, or an issue with my code in the watch app
Are you specifying HTTP_RESPONSE_CONTENT_TYPE_TEXT_PLAIN and are you using a device that handles plain text? (ciq 3 or greater).
Have you looked at/tried the WebRequest sample in the SDK? Maybe just try changing the url in it?
Hi Jim, this is the code I am using, which should return a 200 code plus a message..... but I'm getting a 404 and null.
Code was cut/paste and modified from the SDK example
I'm using Fenix 6X CIQ 3.2
I'm using this code - because I also can't get any of the other responses correct either using POST or GET.
function onReceive(responseCode, responseData) {
System.println("Response code = " + responseCode);
System.println("Response data = " + responseData);
}
function test() {
var url = "">sailing-racer.herokuapp.com/.../dummy";
var data = {};
var options = {
:method => Communications.HTTP_REQUEST_METHOD_GET,
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_TEXT_PLAIN,
};
var responseCallback = method(:onReceive);
Communications.makeWebRequest(url,data , options, responseCallback);
System.println("testsent");
}
testsent
Response code = 404
Response data = null
HTML Traffic:
GET /api/dummy HTTP/1.1\r\nHost: sailing-racer.herokuapp.com\r\nUser-Agent: Mozilla/5.0\r\nAccept: */*\r\n\r\n
Any ideas?
A 404 indicates this:
The website hosting server will typically generate a "404 Not Found" web page when a user attempts to follow a broken or dead link; hence the 404 error is one of the most recognizable errors encountered on the World Wide Web.
I think you'll also see it do to redirects.
When I go to your url, I see this in chrome:
https://sailing-racer.herokuapp.com/api/dummy
and I get back json data:
{"message":"you made an api call to the server"}
Run the WebRequest sample from the SDK and verify it works. Then try your url in place of the one the sample uses. If that works, the issue is in your code, If it doesn't it's something with the url you are using.
Try the url from the sample in your code, as that will show if it's something with your code or now.
Use "View HTTP Traffic" as you are trying these things and look for what's different with the urls/apps.
Thanks Jim..... and no thanks to Kapersky Virus protection !!!!!!!!!!!!!!!
It was blocking stuff without telling me!!!!!!