Well-formed JSON post

Comments

9 comments

  • Stefan Ukena

    Hi Adrian,

    could you provide some details, like the POST data you are sending, your app structure and the error you are seeing. Otherwise nobody will be able to help you.

    Best,
    Stefan

    --
    Die Kollaborateure / Podio Preferred Partner
    http://www.diekollaborateure.com/go/podio/help

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    You can use http://jsonlint.com/ to validate your JSON. Otherwise, post your failing JSON so we can take a look

    0
    Comment actions Permalink
  • Adrian Jones

    Thanks for the offers of help. Here is the error response I am getting back from the API showing my original post:

    {"fields":{"Title":"NM131482-Seminars","category":3,"status":2,"deadline-date":[{"startDate":"2014-10-04"}],"strategy-reference":2551097,"progress":10,"last-update":"2014-04-09","responsibly-person":659257}}{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http:\/\/api.podio.com\/item\/app\/7661778\/","query_string":"","method":"POST"},"error_description":"Invalid value null (null): must be object","error":"invalid_value"}

    0
    Comment actions Permalink
  • Adrian Jones

    The script used to produce the JSON post looks like this:

    function update_post(content)
    Dim objSvr2HTTP
    Set objSvr2HTTP = Server.CreateObject("MSXML2.XMLHTTP")
    objSvr2HTTP.open "POST", "https://api.podio.com/item/app/7661778/", false
    objSvr2HTTP.setRequestHeader "Content-Type", "application/json"
    objSvr2HTTP.setRequestHeader "Authorization", "OAuth2 "&varAccess_Token
    objSvr2HTTP.send content
    update_post=objSvr2HTTP.responseText
    set objSvr2HTTP=nothing
    end function

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    "Title" is certainly wrong since no external_id will be capitalized.

    "deadline-date" doesn't have the right format for a date field. Should probably just be: {"start_date": "2014-10-04"}

    0
    Comment actions Permalink
  • Adrian Jones

    Thanks Andreas - that's really helpful. I can see you are definitely right about the Title field. With the start date, someone told me that start and end dates should be held in an array, which is why I did it like that. Maybe I need to go back to just a straight name:value pair. Anyway, I'll make those changes and let you know how I get on. Thanks again for your help.

    0
    Comment actions Permalink
  • Adrian Jones

    Hi Andreas - I made the changes you suggested, but still getting errors. Here is the response from the API

    {"fields":{"title":"NM131526-Visitor 3","category":3,"status":2,"deadline-date":"2014-10-04","strategy-reference":141145201,"progress":10,"last-update":"2014-04-09","responsibly-person":659257}}{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http:\/\/api.podio.com\/item\/app\/7661778\/","query_string":"","method":"POST"},"error_description":"Invalid value null (null): must be object","error":"invalid_value"}

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    Your date fields are still not what I listed.

    You have e.g.:

    "deadline-date": "2014-10-04"

    It should be:

    "deadline-date": {"start_date": "2014-10-04"}

    And all of this of course assumes that you have all the external_ids for your fields correct

    0
    Comment actions Permalink
  • Seth

    Use this to validate your JSON: JSON Formatter

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk