LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  HTTP Node with POST method

    Employee
    Posted 03-18-2015 08:29

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: kovaden

    Hi all,
    I'm working on new graph, and i want to backup files through HTTP node on our server.
    With GET requests everything is ok, and i can download files from server, but
    there is problem with POST request, and i receive 500 error message, with no description.
    Please help me with Body and Header parameters in this node, what is the format of this parameters?
    I Will be really appreciated if someone provide example of this node with POST request.


  • 2.  RE: HTTP Node with POST method

    Employee
    Posted 03-18-2015 08:39

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    The 500 message says that something on the server failed.
    There's no single Body and Header that will work across all servers .. it will vary greatly from server to server.
    What kind of server is it? What are you trying to upload?

    If you are trying to do a "standard" file backup to a server, you will need a webpage on the server that can accept files, and save them to the disk.

    It will require some server-side scripting, and it could be done in any one of several programming languages.

    A bit simpler approach would be to use the FTP node.. assuming that your server has FTP enabled on it.


  • 3.  RE: HTTP Node with POST method

    Employee
    Posted 03-18-2015 09:06

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: kovaden

    There is a webpage with available POST method on server.
    The main question is, in what section of HTTP node i can provide path to the file, so it can be pushed to the server.


  • 4.  RE: HTTP Node with POST method

    Employee
    Posted 03-19-2015 01:44

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: simon.wilby

    Hi,

    I have an example graph that uploads a file to box.com but as Stony said no single Body and Header will work across all servers, this is due to different api's.
    So it will depend on what the webpage is expecting.
    The "simplest" way to do this is use something like Fiddler to watch your http/https and pass the backup files using a browser (chrome has a few useful rest extensions where you can build up the http post request).
    Once you have the successful request in the browser then that should give you a good idea on what to put into the http node (Or you can paste it here and we can suggest).


  • 5.  RE: HTTP Node with POST method

    Employee
    Posted 03-19-2015 06:38

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: kovaden

    Hi,

    I have installed Fiddler and tried push file to server.
    Here is the results of created POST request in Fiddler:
    Request header:
    Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
    User-Agent: Fiddler
    Host: ****************
    Content-Length: 232
    Request body:
    ---------------------------acebdf13572468
    Content-Disposition: form-data; name="fieldNameHere"; filename="test_file.txt"
    Content-Type: text/plain

    <@INCLUDE *C:\test_file_path\test_file.txt*@>
    ---------------------------acebdf13572468--

    If i understand correctly, i need to find a way how can i pass 'name' and 'filename' parameters to POST reqeust. Is it right?


  • 6.  RE: HTTP Node with POST method

    Employee
    Posted 03-19-2015 07:44

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    I think this portion specifies the filename to use when storing the file on the remote server:
    Content-Disposition: form-data; name="fieldNameHere"; filename="test_file.txt"


    And that this part specifies the data to send:
    <@INCLUDE *C:\test_file_path\test_file.txt*@>


    From the looks of it, I would use the DelimitedFile node with these parameters:
    filename=C:\test_file_path\test_file.txt
    FieldDelimter=!|!|!|!|!        <== a string of text that can't exist in your data
    RecordDelimter=|!|!|!|!|     <== a string of text that can't exist in your data
    FieldNames=myData
    And then in the HTTP node,
     
    BodyType=Field
    BodyValue=myData
    The DelimitedFile node will read all of the data into a single row/column and then the Http node can pass that along.
    You might have to do some URLencoding of your data between the two nodes.


  • 7.  RE: HTTP Node with POST method

    Employee
    Posted 03-19-2015 08:43

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: simon.wilby

    This is very similar to the box.com post request in that that expected multipart/form-data content.

    you want to put the following into the ContentType parameter:
    multipart/form-data; boundary=-------------------------acebdf13572468

    I'm assuming the post request doesn't require authentication but that would go into the Header parameter if required.

    The request body would go into the Input-Body field. you'll need to build the "Body" in a filter node prior to the http node to create new lines successfully.
    so it would look something like this in a filter node (assuming that filename is coming from an input pin called filename, the content of the file is from an input called RawData)

    boundary = "---------------------------acebdf13572468"
    body_string = "\r\n"
    + "Content-Disposition: form-data; "
    + "name=\""
    + filename
    + "\""
    + "; filename=\""
    + filename
    + "\"\r\n"
    + "Content-Type: text/plain\r\n\r\n"
    +RawData
    +"\r\n"
    +left(boundary, strlen(boundary) - 2)
    + "--"
    + "\r\n"

    emit body_string

    let me know if that's not clear enough and I can modify the graph I have to something a little clearer


  • 8.  RE: HTTP Node with POST method

    Employee
    Posted 04-09-2018 22:35

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Xavierjs

    Kovaden,

    Can you assist me.. I have 2 files that I need to send to a remote server. We do not have to use tokens or proxy servers. Just a username and password. However, I am unsure what we have to fill in in the tabs for the INPUT, OUTPUT, OPTIONAL. We have tried but we are getting errors just as the METHOD cannot be null, etc. ALos we have tried all the combinations with the ServerAuthenticationMethod.