Jump to content

Second Post Request


garybixler

Recommended Posts

Posted

Hi

I have the following in the Resource Editor

that is set for 'post' and 'raw text':

 

POST /ethAccount.asmx/SignIn HTTP/1.1

Host: urlname

Content-Type: application/json; charset=utf-8

Content-Language: json

Connection: keep-alive

User-Agent: Mozilla/4.0

{ "email" : "myemail", "password" : "mypass" }

 

POST /ethClient.asmx/Ping HTTP/1.1

{ "id" : "0" }

 

I think the first part works as I get a return of HTTP 1.1 2 without the second post attached.

What I would like to do is attach the second request to the first in order to use the

same logged in session. I know it is a lot more complex then just adding a post. One time the

editor came back with a string starting with 'Request ..... but I failed to wright it down.

The data{} is what is required in the APIs

So, I guess the question is whether or not this is possible?

 

Thanks much for any assistance.

Gary

l

Posted

Hi Gary,

 

I do not think the first part is POST since you don't have a content-length = the length of the body.

 

Also, if you want to do pipelining, what you need to do is to add ALL the headers for the second post inside the body of the first post. This should include content-length. Furthermore, you will have to use C-Escaped since, for the second post, the header must be separated from the body by \r\n\r\n.

 

With kind regards,

Michel

Posted

Thanks l very much Michel for your reply.

I didn't put the length in because the ISY always seems to figure that out and enter it into the content length. I'm not sure how to figure that out. Do you just count the characters in the body?

Also I would be greatly thankful if you could show a sample of what the parameters might look like. Been at this in different ways now for about two weeks including trying to use Python in EventGhost.

 

Thanks.

Gary

Posted

Hi Gary,

 

I'm not sure how to figure that out. Do you just count the characters in the body?

Yes.

 

Also I would be greatly thankful if you could show a sample of what the parameters might look like. Been at this in different ways now for about two weeks including trying to use Python in EventGhost.

 

Please try this:

Make sure you use POST and C-Escaped. Connection-Close should be keep-alive.

 

---> for the first one, simply let ISY create the package for you. The body would be
{ "email" : "myemail", "password" : "mypass" }
---> Then, in the body, add the following:

POST /ethClient.asmx/Ping HTTP/1.1\r\n
Host: urlname\r\n
Content-Type: application/json; charset=utf-8\r\n
Content-Language: json\r\n
Connection: keep-alive\r\n
User-Agent: Mozilla/4.0\r\n
Content-Length: 28\r\n\r\n
{ "id" : "0" }
{ "id" : "0" }

 

With kind regards,

Michel

Guest
This topic is now closed to further replies.

×
×
  • Create New...