Not able to post message using AT+HTTTPPOST in HL6528


#1

Hi ,
I am using the HL6528 Sierra module.
Version info: Sierra Version: SIERRA HL6N,003.00.200B.7175B

I am using thingsboard.io as the platform.
I have created a device on the thingsboard server and want to upload the data.
Below is the AT+ commands i used.I am not able to send the data using AT+HTTTPPOST command.
Below is the sequence of commands executed—

IP address:
AT+KHTTPCFG=1,“IP-address”,8080,0,“login”,“pwd

OK ---->response comes correctly.

AT+KHTTPHEADER=0
CONNECT — Connect response comes.
Then sent below parameters :

Content-Type: application/json;charset=utf-8
Content-Length: 30
token: yB00dpprAKhtlkKuVLf9
–EOF–Pattern–
OK

AT+KHTTPPOST=0,"/api/v1/yB00dpprAKhtlkKuVLf9/attributes/"
Connect -----Command responses with connect and gives the below error.

HTTP/1.1 415
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 26 Jul 2018 13:25:42 GMT
1e0

{“timestamp”:1532611542256,“status”:415,“error”:“Unsupported Media Type”,
“exception”:“org.springframework.web.HttpMediaTypeNotSupportedException”,
“message”:“Invalid mime type “application/json;charset=utf-8Content-Length: 30
token: yB00dpprAKhtlkKuVLf9Authorization: Basic dGVuYW50QHRoaW5nc2JvYXJkLm9yZzp0ZW5hbnQ=”: utf-8Content-Length: 30
token: yB00dpprAKhtlkKuVLf9Authorization: Basic dGVuYW50QHRoaW5nc2JvYXJkLm9yZzp0ZW5hbnQ=”,“path”:"/api/v1/yB00dpprAKhtlkKuVLf9/attributes/"}

It tells the error as Unsupported media type.Please let me know where I am missing the steps.
Please provide any sample AT+HTTPPOST data sending steps.


#2

Hi harshsi2micro,

Just tried create new account on thingsboard and able to post using HL7690 +KHTTP command.

From you log, it seems the header sent twice (for example duplicated “Content-Length: 30” keyword), can you check your send sequence? also if newline add properly?
Also the firmware version in your HL6 is outdated, maybe good to test with latest.
https://source.sierrawireless.com/resources/airprime/software/hl6528x-firmware-8,-d-,10/

Below my test log for reference:

ati3
RHL769x.2.22.172000.201705261415.x7120m_1

OK
AT+KCNXCFG=1,“GPRS”,“hkcsl”
OK
AT+KHTTPCFG=1,“demo.thingsboard.io”,8080,0
+KHTTPCFG: 1

OK

+KCNX_IND: 1,4,1
AT+KHTTPHEADER=1
CONNECT

Send below header (masked the token)

Content-Type: application/json;charset=utf-8
Content-Length: 53
token: xxxxxxxxxxxx
–EOF–Pattern–

OK

+KCNX_IND: 1,1,0

+KHTTP_IND: 1,1
AT+KHTTPPOST=1,"/api/v1/xxxxxxxxxxxxxxxx/attributes/"
CONNECT

send below as attributes JSON

{“firmware_version”:“2.22”, “device_number”:“HL7690”}

HTTP/1.1 200
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 0
Date: Wed, 01 Aug 2018 12:23:59 GMT

–EOF–Pattern–
OK

+KHTTP_IND: 1,3,53,200,""

Hope it helps.
Thx


#5

Hi,

Thanks for the suggestions lotam,

First I would like you say that we are using HL6528-2.8V module, As per your input we updated our module ( HL6528-V2.4) firmware versions from V3 to V8.10 (firmware details - HL6N_003_00_200B_p7175C.pac, HL6N_005_00_200B_p7264A.pac, HL6N_006_00_20CF_p7318A.pac , HL6N_007_01_20CF_p7378B.pac & HL6N_008_10_20CF_p7436B.pac)

Each firmware updation we tried to send data through AT+KHTTPPOST command with respective path along with header command(AT+KHTTPHEADER),
but unfortunately every-time we are getting HTTP/1.1 415 Error and NO RESPONSE from Module, so that unable to update any data in thingsboard server.

we tried to send header format with and without carriage return and line feed, Example given below:

TX: AT+KHTTPHEADER=0
RX: CONNECT

TX: Content-Type:application/json
TX: token:yB00dpprAKhtlkKuVLf9
TX: Content-Length:64
TX: --EOF–Pattern–

RX: OK

Is it correct format for sending data???

For more details we are attaching HL65_7.0_AT_Data.txt file complete log , Please go through that log and Please suggest us solution to upload data in thingsboard server.HL65_7.0_AT_Data.txt (1.3 KB)


#6

Hi harshsi2micro,

The attached log does not show the data you send after +KHTTPHEADER and +KHTTPPOST command.
But per example you provided, you are not sending carriage return, but actually you must include carriage return at least.

Below the data I sent after +KHTTPHEADER, “\r” is 0x0d (carriage return):

Content-Type: application/json;charset=utf-8\rContent-Length: 53\rtoken: xxxxxxxxxxxx\r–EOF–Pattern–

Hope it is clear for you.
Thx


#7

Thanks for your quick reply Louis!!
As per your suggestion we did tried sending the header parameters.(HL6528 upgraded to latest firmware -HL6N_008_10_20CF_p7436B.pac)

Tried1 – only sending the Carriage return at the end of header parameter.
E.g
Content-Type:application/json;charset=utf8<CR>

Tried2 – Sending the carriage return at the start of header parameter and end of header parameter.
E.g
<CR>Content-Type:application/json;charset=utf8<CR>

Both time we are seeing the same error as given below.
CONNECT
HTTP/1.1 415
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 08 Aug 2018 05:41:20 GMT
1dc
{“timestamp”:1533706880958,“status”:415,
“error”:“Unsupported Media Type”,“exception”:“org.springframework.web.HttpMediaTypeNotSupportedException”,
“message”:“Invalid mime type “application/json;charset=utf8
Content-Length: 53token:yB00dpprAKhtlkKuVLf9Authorization: Basic dGVuYW50QHRoaW5nc2JvYXJkLm9yZzp0ZW5hbnQ=”: utf8
Content-Length: 53token:yB00dpprAKhtlkKuVLf9Authorization: Basic dGVuYW50QHRoaW5nc2JvYXJkLm9yZzp0ZW5hbnQ=”,
“path”:"/api/v1/yB00dpprAKhtlkKuVLf9/attributes/"}

The above error appear just after we execute the AT+HTTPPOST command.(i.e before we send the data itself).
And when we expilicity send the data after this error Data is :- {“firmware_version”:“2.22”, “serial_number”:“HL6528”} we see the below error

HTTP/1.1 400
Transfer-Encoding: chunked
Date: Wed, 08 Aug 2018 05:55:20 GMT
Connection: close
0
–EOF–Pattern–
OK

Please let us know what might be the issue!!!


#8

Hi harshsi2micro,

From your new log, it seems server received duplicate data in header again (i.e. there is 2 “Content-Length” field).

Can you share how do you send the header content? what terminal tool you are using?

I don’t have HL device now, but below what I am doing:

AT+KHTTPHEADER=1 (Enter)
wait for CONNECT then send below (CR “\r” 0x0d at end of each header line)

Content-Type: application/json;charset=utf-8\r
Content-Length: 53\r
token: xxxxxxxxxxxx\r
–-EOF-–Pattern–-

Thx


#9

Hi Louis,
Thank You for the providing the support!!!

I tried once again by sending the header parameters by ending with both (Carriage return and Linefeed) and I was able to successfully upload the data to the Thingsboard server.

I am using Dockilght Tool to send the AT+ commands to the HL6528 and Version info: Sierra Version: SIERRA HL6N,003.00.200B.7175B.

The final sequence of the execution looks like this:—

AT+KCNXCFG=1,"GPRS","www.airtelgprs.com",,,"0.0.0.0","0.0.0.0","0.0.0.0"<CR>
OK

AT+KHTTPCFG=1,"***IP***Address",8080,0,"tenant@thingsboard.org","tenant"<CR>
OK

AT+KHTTPHEADER=0<CR>
CONNECT

Content-Type:application/json<CR><LF>
token:yB00dpprAKhtlkKuVLf9<CR><LF>
Content-Length: 49<CR><LF>
--EOF--Pattern--

OK

AT+KHTTPPOST=0,,"/api/v1/yB00dpprAKhtlkKuVLf9/attributes/"<CR>
CONNECT

----Data sending--------
{"firmware_version":V3.0, "serial_number":HL6528}

CONNECT
HTTP/1.1 200
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 0
Date: Wed, 08 Aug 2018 10:57:42 GMT

I would suggest to please provide infromation regarding how to send the header parameters in the updated AT+ commands refernce manual.
How to terminate the header parameters is missing as given in the demo example (page number 741 HL6528 AT+ Command refernce manual)!!


#10

Good to know, yes, Docklight is one of my favorite tool too.
It is professional enough that user can control each exact char being sent and received, and maybe that’s why you didn’t add the separate char at the beginning.

Kindly mark this ticket as resolved.
Thx