Rest Client for Firefox – Sample POST Request

I was having fits getting the REST Client for Firefox to let me create a post body where PHP would recognize the parameters I was trying to post. I added them to the “request body” but my REST server wasn’t showing that I was even posting anything.

I found out that you have to set the “request header” section of the Firefox plugin to have a “name” = “Content-Type” and “value” = “application/x-www-form-urlencoded”. Then I was able to put something like “name=themayesfamily” in the “request body” and my server found a post variable with called “name” with the value I’d set.

Hope this helps some others.

This entry was posted in programming and tagged , , , , . Bookmark the permalink.

9 Responses to Rest Client for Firefox – Sample POST Request

  1. Mike says:

    Thanks this really helped

  2. Thank you. I knew I had to put a header in but wasn’t sure if it was one line or a bunch of lines. Glad this cleared it up!

  3. Pete O'Shea says:

    I was struggling setting up post content with RESTClient for a while. This was the number one post in my Google search and answered my question perfectly. Thanks

  4. Tobias Wittur says:

    Hi,

    Firstly cheers for your post. It has been a great help. Does anyone know how to separate multiple Post parameters?

    I entered this in my request body: key1=value1;key2=value2 …

    Unfortunately I end up with only one POST paraemter key1 in php, which contains value1;key2=value2 as value.

  5. Paulino III Santos says:

    Tobias Wittur!

    This is a super late response, but the correct way to separate multiple POST parameters is the same as it works in URLs using the ampersand ‘&’ to separate the values. Example : key1=value1&key2=valu2&key3=value3. Remember to specify ‘application/x-www-form-urlencoded’ under Body/Content Headers/Content-Type.

    Cheers!

  6. Christian says:

    Nice info but what if I need authentication by specifying username and password and at the same time I put JSON code in the body? I cannot put POST fields in the body ’cause the JSON would result malformed.
    Thanks!

  7. zhangtao says:

    good! this really helps me !!! thanks!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>