HTTP POST Request in a Command

Home Forums V-Control General HTTP POST Request in a Command

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #6787
    atallon10
    Participant

    I am trying to send an HTTP request to a color corrector which is accessed via a web GUI. I have the Channel set up with the port and IP address and the method selected as POST. I’m requesting a CGI script from the server and I need to pass a couple of key/value pairs. How can I structure this in a Command?

    #6793
    Dierk
    Participant

    Maybe you can use the ALL 4076 driver as template. The device is for something completely different than color correction, but it also uses http.

    If you can’t success, can you post the protocol of your device here?

    #6925
    atallon10
    Participant

    I checked out the ALL 4076 driver as you suggested. The ALL 4076 receives an HTTP request using the GET method. My color corrector receives requests using the POST method. Specifically, I need to send a POST request to address http://“ipaddress”/html/utility/event_ctrl.cgi. In the body of the POST request, I need to pass a key/value pair of load=2&mode=0. I was able to successfully send the request using Postman. I’ve attached the output of the request from Postman in case this helps.

    Attachments:
    #6927
    JonasStade
    Participant

    Hrhr I had the same issue the last days with Pixera. So the answer is: you need the

    content-length: 22

    This has to be the counting of all used symbols in the command. I just do a pre scriptresult as string, let’s call it

    JSON=„Chenjdnjxunwbsi“
    lenght=„content-length: „+str(Len(JSON))

    Len() counts all symbols but the output is integer so I directly change this back to string for the output.

    #6928
    JonasStade
    Participant

    this is freshly code from my new driver, IMPORTANT IS ALSO THE / at the beginning, because instead it would net be described as HTTP (for example wireshark and so on)

    dim enter,two,nine,ten,m,json as string
    m=””””
    enter = chr(13) + chr(10)
    json=”{“+m+”jsonrpc”+m+”:”+m+”2.0″+m+”, “+m+”id”+m+”:54, “+m+”method”+m+”:”+m+”Pixera.Timelines.Timeline.getTransportMode”+m+”, “+m+”params”+m+”:{“+m+”handle”+m+”:”+P1+”}}”
    two= “Content-Type: application/json”+enter
    nine=”content-length: “+str(Len(json))+enter
    ten=”Connection: keep-alive”+enter+enter

    ScriptResult = “/ ” +two+nine+ten+json+chr(10)

    #6939
    Dierk
    Participant

    To send Post instead of Get you only have to select Post Method in the Channel

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.