HTTP Post Request to Matlab Thingspeak
19. 4. 1 오후 8:05

I have changed some coding based on previous work. However, I always failed to post request to the channel of thingspeak. I have check the channel api key via ''postman'' and its stated that the channel is functioning. I show my coding here and I hope someone could help me to solve this problem. Thank you.

My problem is I dont know how to add in the Api key. I have tried to insert at the coding below. Obviously it is wrong. But, at least the code can run. I would like to know the problem.


retcode_t writeNextPartToBuffer(OutMsgSerializationHandover_T* handover)


const char url_ptr[100];

int payload;

int n = "api_key=H2XL7UF32O1T2V3Y&field1=1";

uint32_t payloadLength = (uint32_t) strlen(payload);

uint32_t alreadySerialized = handover->offset;

uint32_t remainingLength = payloadLength - alreadySerialized;

uint32_t bytesToCopy;

retcode_t rc;


if ( remainingLength <= handover->bufLen ) {

bytesToCopy = remainingLength;

rc = RC_OK;


else {

bytesToCopy = handover->bufLen;




Additionally, I have insert the website at this code.

void createAndSendPostMessage(void){

// assemble the request message

Ip_Address_T destAddr;

NetworkConfig_GetIpAddress((uint32_t) "", &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 투표)
RE: HTTP Post Request to Matlab Thingspeak
19. 4. 3 오전 8:41 as a reply to l Kent.


Please refer this post for more information


Santhosh babu


0 (0 투표)