trouble integrating the software for a post request. for the moment I managed to make get requests without problem.
but for post requests, it’s a different story.
i actually work with firmwae => BX310x.2.5.0-2
in the header of all my get requests, I only put the token like this :
AT+KHTTPCFG=0,sophixxxxxxxxrod.com,80
+KHTTPCFG: 3 CRLF
OK CRLF
AT+KHTTPHEADER=3
CONNECT CRLF
Authorization: Bearer C9zb3BoaWEuZGV2LWtleXByb2QuY2xxxxxxxxxxxxxxvZ2luIiwiaWF0IjoxNTgwODg2Mzc1LCJleHAiOjE1ODA5Nz CRLF
+++
OK CRLF
AT+KHTTPGET=3,"/api/mxxxines"
CONNECT
HTTP/1.1 200 OK
Date: Wed, 05 Feb 2020 07:10:25 GMT
Server: Apache
Vary: Authorization
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Headers: Content-Type, X-Auth-Token, Origin, Authorization
Cache-Control: no-cache, private
Content-Length: 2418
Keep-Alive: timeout=65, max=100
Connection: Keep-Alive
Content-Type: application/json
[{"machine_id":1,"machine_name":"My machine","machine_color":"grey","machine_ip".......
Where I'm blocking today is that I'm trying to make a post request that sends data in json format, and for that, I have to add other parameters in the header in addition to "authorization" :
i have to add => Accept: application/json and Content-Type: application/json, but I don’t know how to separate in the header the three parameters Authorization, Accept and Content-Type, should I do it with a comma? a CRLF? BOTH ? or just a space.
Then after the post request, you must write the data to send, but in the datasheet it is not specified if you have to finish the data with a CRLF.
in the datasheet it’s say you receive server response before typing “+++”, but for me i have response after typing “+++”:
this is how i make my post request :
I have the error 10 that say 10—HTTP got no data
I think that module wait the end of data of the post request , but i don’t know what i should add in the end of my string , \r ? \n? thanks for help.