Good day, I have set up this chanel in Matlab Thingspeak. The status keep showing "Failed to send HTTP request". May I have some solutions? Thank you.

void createAndSendGetMessage(void){

Ip_Address_T destAddr;

NetworkConfig_GetIpAddress((uint32_t) "https://api.thingspeak.com/update?api_key=H2XL7UF32O1T2V3Y&field1=0", &destAddr);

Ip_Port_T port = Ip_convertIntToPort(80);

Msg_T* msg_ptr;

HttpClient_initRequest(&destAddr, port, &msg_ptr);

HttpMsg_setReqMethod(msg_ptr, Http_Method_Get);

HttpMsg_setReqUrl(msg_ptr, "/ip");

 

// send the request

static Callable_T sentCallable;

Callable_assign(&sentCallable, &onHTTPRequestSent);

HttpClient_pushRequest(msg_ptr, &sentCallable, &onHTTPResponseReceived);

}

0 (0 Stimmen)
RE: Failed to send GET request to Matlab Thingspeak Chanel
Antwort
01.04.19 08:21 als Antwort auf l Kent.

Hi,

We have tested httpexampleclient application with the "api.things.speak.com" the post is successful but the get is failed beacuse callback for the get CB was not received"

thanks

santhosh babu

 

0 (0 Stimmen)
RE: Failed to send GET request to Matlab Thingspeak Chanel
Antwort
01.04.19 10:30 als Antwort auf santhosh babu el.

I should change the code as below and adapt to the example on the bosch connectivity? Or could you please show the code that you have tested babu? Thank you very much.

 

void createAndSendPostMessage(void){

// assemble the request message

Ip_Address_T destAddr;

NetworkConfig_GetIpAddress((uint32_t) "api.things.speak.com", &destAddr);

Ip_Port_T port = Ip_convertIntToPort(80);

 

Msg_T* msg_ptr;

HttpClient_initRequest(&destAddr, port, &msg_ptr);

HttpMsg_setReqMethod(msg_ptr, Http_Method_Post);

HttpMsg_setReqUrl(msg_ptr, "/post");

 

Msg_prependPartFactory(msg_ptr, &writeNextPartToBuffer);

 

// send the request

static Callable_T sentCallable;

Callable_assign(&sentCallable, &onHTTPRequestSent);

HttpClient_pushRequest(msg_ptr, &sentCallable, &onHTTPResponseReceived);

}

0 (0 Stimmen)
RE: Failed to send GET request to Matlab Thingspeak Chanel
Antwort
02.04.19 05:55 als Antwort auf l Kent.

Hi

Please test the application HttpExampleClient under xdk110/Apps in Workbench 3.6.0.Do the following changes in the AppController.h under xdk110/Apps/HttpExampleClient/source/Appcontroller.h

#define WLAN_SSID                           "YourSSID"

#define WLAN_PSK                            "YourWifiPassword"

#define DEST_SERVER_HOST                "api.thingspeak.com".

Please clean and build the application.

please revert back  for any queries.

thanks

santhosh babu

 

 

 

 

 

 

 

0 (0 Stimmen)
RE: Failed to send GET request to Matlab Thingspeak Chanel
Antwort
02.04.19 21:05 als Antwort auf santhosh babu el.

Is that the cosole below shows that I have succesfully sent the request? I could see that there is some error. May I know what is the meaning of that error? Thank you
 

INFO | XDK DEVICE 1: HttpRestClientPostResponseCallback: received HTTP status other than 200 OK. status=0

INFO | XDK DEVICE 1: HttpRestClientPostResponseCallback: error while receiving response to POST request. error=1387 (Note : RC_HTTP_CLIENT_NO_RESPONSE-1387 , RC_HTTP_SEND_ERROR-1357)

0 (0 Stimmen)
RE: Failed to send GET request to Matlab Thingspeak Chanel
Antwort
03.04.19 08:38 als Antwort auf l Kent.

Hi

This message you are getting because the HTTP POST is sucessful from XDK device side seems like HTTP POST is failed from the server end.

thanks

Santhosh babu

0 (0 Stimmen)
RE: Failed to send GET request to Matlab Thingspeak Chanel
Antwort
04.04.19 09:43 als Antwort auf santhosh babu el.

Hi

Can I add in the ''API key'' and ''Field1=1'' as shown in the code below?

 

/**

* POST_REQUEST_CUSTOM_HEADER_0 is a custom header which is sent along with the

* POST request. It's meant to demonstrate how to use custom header.

*/

 

#define POST_REQUEST_CUSTOM_HEADER_0 "H2XL7UF32O1T2V3Y"

 

/**

* POST_REQUEST_CUSTOM_HEADER_1 is a custom header which is sent along with the

* POST request. It's meant to demonstrate how to use custom header.

*/

#define POST_REQUEST_CUSTOM_HEADER_1 "field1=1"

0 (0 Stimmen)