Can't make HTTP HEADER for GET request (BX3100)

I currently use a wifi module BX3100 ( firmware 2.5), to make http requests with APIs, I validate the tcp ip communication mode, but I can’t do GET with our http servers to test.

i think my problem come from the HTTP HEADER, because it’s little confued about ading the “\r” and the “+++”.

I use a web client to test the server response, and here is what I need to get with this server :

It’s normal ! i want to obtain this message status “401” with => “message”: …

So this is how i proceed with my module BX3100 :

     Terminal => AT+SRWCFG=1,3
     Rsp => OK

     Terminal => AT++SRWSTACFG=xxx,xxx
     Rsp => OK

     Terminal => AT++SRWSTACON=1
     Rsp => OK
     Rsp => +SRWSTASTATUS: 1,“xxx”,“a0:ab:xx:xx:xx”,9,3
     Rsp => +SRWSTAIP: “1xx.xx.1xx.11”,“”,"1xx.xx.103.2xx

     configure http session
     Rsp => +KHTTPCFG: 1
     Rsp => OK

     Terminal => AT+KHTTPCNX=1
     Rsp => OK

     //Then I edit the Header :
     Terminal => AT+KHTTPHEADER=1
     Rsp => CONNECT
     Rsp => OK 

     //I check the header :           
     Terminal => AT+KHTTPHEADER?
      Rsp =>                                                           
           +KHTTPHEADER: 1,25                                                            
           Accept:application/json crlf

     // I make the get request : 
    Terminal =>  AT+KHTTPGET=1,"api/machines"
     Rsp =>
                  HTTP/1.1 400 Bad Request
                  Date: Sun, 19 Jan 2020 17:59:29 GMT
                  Server: Apache 
                  Content-Length: 226

So the respons of the GET request, proves that i can communicate with the server, but i send GET request with the wrong format.

Sur la commande AT+KHTTPHEADER=1, i try lot of format of the header:

  • i try Accept:application/json \r\n then +++
  • i try Accept:application/json +++
  • i try +++
    I really not understand why i have this response, i should have the same reponse like the http client that i use in the beginig.

there is the log of my communication :

some one have any idea ! ? @Sierra_klin2, , maybe be you can help me ? thanks.



Please try the following, it works my side. See enclosed my logs.
AT+KHTTPHEADER? -Keep it empty.
AT+KHTTPGET=1,"/api/machines" -Add ‘/’

LOG.7z (54.5 KB)

1 Like

Thanks @Sierra_klin2 for your help, i have one question about writing http header with " Authorization " , it’s look like the format of my header are wrong !

  Terminal => AT+KHTTPHEADER=1
  Rsp => CONNECT
  Authorization : Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9zb3BoaWEuZGV2LWtleXByb2QuY29tXC9hcGlcL2xvZ2luIiwiaWF0IjoxNTc5NTA2MjM4LCJleHAiOjE1Nzk1OTI2MzgsIm5iZiI6MTU3OTUwNjIzOCwianRpIjoicko1MmU3Z2JXM\r\n
  Rsp => OK 

Do i’m write the header with good format ? i don’t know how the BX3100 encode my string header !

Also another thing ! with HTTP/1.1, the connection is no longer closed after one request, and the client is now granted a further request, but it’s look like when i make one request, i can’t make another request, every time should creat new session ?