Updating Orders to "Complete" using HTTP PUT

Joshua Sherlock's Avatar

Joshua Sherlock

04 Sep, 2012 08:42 AM

Hi Guy's,

Long time no speak!

I've had a chance to revisit the old code I wrote to pull orders from Handshake using HTTP GET requests (JSON format results) and inject them into our ERP system and would now like to update order statuses in Handshake from "Confirmed" to "Complete" using a HTTP PUT/POST.

Can you provide an example? I believe the PUT/POST request will have a URL something like:

https://xxxxxxxxxxxxxx:[email blocked]/api/v2/orders/36001

But not sure on how to provide the parameters/content that needs be updated. I'm currently using Java, but any code example in any language would be fine to get the ball rolling.

Long term I'm love to use this mechanism to sync our Customer & Products files with the ERP.

I'm sure it will be a piece of cake, but I defer to your Guru like knowledge in this matter :-)

Josh Sherlock
The Distributors Perth

  1. Mike closed this discussion on 17 Sep, 2012 01:39 PM.

  2. Glen re-opened this discussion on 12 Oct, 2012 04:33 AM

  3. Support Staff 2 Posted by Glen on 12 Oct, 2012 04:33 AM

    Glen's Avatar

    Hi Josh,

    Sorry for such a slow reply on this one. It fell down my queue and I did not notice I hadn't gotten around to it.

    I'm not quite sure about the URL you posted as an example, but that wouldn't really work as a PUT / POST target. You should be doing a PUT to a URL like


    ... without any other authentication stuff in the URL itself. Our API uses HTTP Basic Authentication (as per http://handshake-app.com/help/kb/api/api-authentication) but I'm sure you already know that because you must have implemented it in order to write your GET logic earlier.

    The easiest way to figure out what to PUT is to just take the data that you see when you do a GET on the same URL, then change the little bit you want to change (e.g. the status) then PUT the same data back. The API is designed to "eat its own dogfood", so whatever it gives you in a GET response should be usable as a PUT request back onto the same URL, if that makes sense.

    In the case of orders, you probably want to strip out the lines array to make things simpler before doing a PUT back to the server.

  4. 3 Posted by Joshua Sherlock on 12 Oct, 2012 04:47 AM

    Joshua Sherlock's Avatar

    HI Glen,

    Thanks for the response.

    I've had a play with it and this is basically what has worked:


    Content-Type application/json
    Basic Authorization xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


    This worked up until the 3.3 update, now I get the following response:

    Status Code: 400 BAD REQUEST
    Connection: keep-alive
    Content-Type: application/json; charset=utf-8
    Date: Fri, 12 Oct 2012 04:37:56 GMT
    Server: nginx/1.0.15
    Transfer-Encoding: chunked
    Vary: Cookie

    {"all": ["36001/ is not a valid object ID (must be an integer)"]}

    Looks like a trailing slash has been appended at some point once the request is sent., Can still GET orders, but cannot update their status. Seems to just be when I refere to an individual order rather than a filtered range.

  5. Support Staff 4 Posted by Glen on 12 Oct, 2012 04:55 AM

    Glen's Avatar

    Hi Josh - thanks for bringing this to my attention. There were some changes to our web proxy settings for 3.3 and I have temporarily disabled these to allow your API requests to continue to work properly.

    I have assigned Angel to this ticket, who was working on those proxy changes. We'll get them done properly and then update.

  6. 5 Posted by Joshua Sherlock on 12 Oct, 2012 04:56 AM

    Joshua Sherlock's Avatar

    Hi Glen,

    Last post dropped some formatting, BODY should be:


  7. Support Staff 6 Posted by Angel on 12 Oct, 2012 04:35 PM

    Angel's Avatar

    Hey Josh,

    First, I just want to apologize for the trouble with the recent proxy changes. We've identified the issue and released a fix for it.

    Please let me know if you continue to have any trouble.

    - Angel, Handshake

  8. Angel closed this discussion on 12 Oct, 2012 04:35 PM.

Comments are currently closed for this discussion. You can start a new one.

Recent Discussions

01 Feb, 2013 01:09 AM
31 Jan, 2013 10:20 PM
31 Jan, 2013 07:21 PM
25 Nov, 2012 01:57 AM
30 Jan, 2013 06:56 PM