Problem With GSM SIM800C POST method

I want to send my sensor data to API.My data in json format. I am using GSM with Arduino and sending HTTP command through software serial library.
POST method code as follow:

void send_http_request() {








void read_data() {

  String line;
  while (gsm.available() > 0) {
    char data =;
    line += data;



Problem: Data do not receive properly or sometimes it receives incomplete response. please help me. All command work properly in AT mode but I want to send the command through programming

Hi Ashwini,
You are doing it the wrong way. You should not just put delays if you want to write a perfect code. You should wait for responses and handle them. You should only execute the next code when you get a OK or ERROR responses from previous command. Without looking at what the module sent back, if we just send the next command, it would lead to problems.

do you have any example .Please send on my mail id

This is written for linux, it should help

I did as you told. I send next command after verify previous command. I have Json data in response . after that i call function jsonexact(); . some time arduino skip function and send next gsm command. I don’t understand how this happen?

I havent used jsonexact(). But if the JSON format you received back is not correct the function can return error and skip. But it should should not skip without entering.
You can print a text in the jsonexact function to see if the code flow is entering into it.

I have project . I get json response from server.

  1. Some time receive half response.
    if I use function
    while (gsm.available()<0){} // for wait to available
    while (gsm.available()<0){ read data}
    still sometime it give half response.

  2. I send response to function
    fucntion unable to parse.

please your expert in GSM .

Do you have enough buffer space to read the response?
How long is data response and what is the size of the buffer you are using?

response is 211 byte. buffer is 256

You should capture the data flow on UART to a text file for analysis, Then we can find out if the module is putting out the full response to the MCU or not.

not understand what you said??

You should capture the AT Command flow between GSM module and MCU UART lines. You need USB-UART converter for this to capture data to PC. This data will help in analyzing whats happening.

Thank you for help me. my problem get sort out. actually this my coading issue .
Thank you once again. I am so happy

Glad you got it working :slight_smile:

hey ive been reading your help but for me i cant make it can u please give me a help

when am writing AT+HTTPPARA=“CONTENT”,“application/json”
am getting error s there any good way i can make it

i have read your procedure for HTTP post in the case of multipart form-data. but it gives me 400 error message.

attaching my code i have given delays instead of reading the response but here i didint mentioning it. because every AT commands giving OK response . and HTTPREAD response is 1 ,400,34 and error parsing content disposition

i am unable to attach the code here, because here they showing error message that it is not allowed for the new user to upload file.