Jump to content

REST API POST Request return error code 3 ("No packed received")


Pista

Recommended Posts

Hello,

has anyone done data loading using POST request?


Using GET, according to the instructions, it works fine.

For example GET request  from  https//api.weatherapi.com/v1/current.json  it  works fine.

But now I need a POST command.

It works with a computer OK.

But My PLC  US10-B10-T24  returns error 3  "No packed received".

Can anyone tell me, where I am making a mistake?

 

Post test.PNG

RestPost1.JPG

RestPost2.JPG

RestPost3.JPG

RestPost4.JPG

Link to comment
Share on other sites

  • NoamM changed the title to REST API POST Request return error code 3 ("No packed received")
  • 3 weeks later...

Hi NoamM,

thank you for your response.
I had the wrong DNS address. Ping works fine.
I made my own webserver on my computer to see what the PLC sends me. (B4J software)
It works on my web server but not on the company server.
The company server returns an HTTP error.

I suspect that the PLC sends the POST command in the same way as the GET command is sent.

MetaData and URI as sent by the application are captured in the image.
Method: POST, OriginalURI: /can_test2
And request is in table.

But PLC sends:
method:       POST
OriginalURI:      /can_test2? Tester=fogonly&Barcode=ABCD
table= NULL

posttest1.PNG.0d570fcb9a1e4651825d7fe127e39c99.PNG

posttest2.thumb.PNG.8eed40661f261bec4667cd6c6952c132.PNG

posttest3.thumb.PNG.2cfb4059b00e3db688437a6027b2c357.PNG

Do you have any idea how to feed POST function in PLC unitronics?

Link to comment
Share on other sites

Hi, If you are using 1.33.236, there was a bug " REST: Requests with Hard-coded content parameters did not work"
On the latest released version on the site 1.33.348 it is fixed.

In your screenshot I don't see the content parameters part (the part where you fill the data you want to POST)
What are you trying to POST?

I think you tried to put the post data in query parameters instead of the content parameters.

You wrote the PLC sends: " /can_test2? Tester=fogonly&Barcode=ABCD",  which is a POST request without any data.

Try to put the POST data in Content parameters.
 

  • Upvote 1
Link to comment
Share on other sites

Hi Elad S,

I downloaded the latest software version 1.33.348 and it doesn't work.
But I found that the PC application is sending Content-Type : application/x-www-form-urlencoded\r\n
and PLC sends Content-Type : application/json\r\n.


Unfortunately, the customer's server does not support  the POST request with json Content type .
Do you have an idea how to solve this?
Well thank you.

SharktestB0.thumb.PNG.1fea8abd71efed9e1f4dd409052c5e8c.PNG

PLC send

SharktestB1.thumb.PNG.ce5d88370cd631a188e06fa371227792.PNG

PC application send

SharktestA1.thumb.PNG.7a8367fa52e3cf237223170730d22b42.PNG

Link to comment
Share on other sites

  • 7 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...