Help with proper url PUT structure for changing app field (relationship)

Comments

4 comments

  • Marek Hruzik

    Hi Samson,

    I think the request you are sending is not going through successfully - you probably get a "Bad Request" (400) status code.

    The payload for the app field and the operation you are using (Update item values) can be one of the following:

    { "value":item_id_1 }

    or

    [{ "value":item_id_1 }, { "value":item_id_2}, ...]

    or

    [item_id_1, item_id_2, ...]

    br
    Marek

    0
    Comment actions Permalink
  • Samson Burton

    When I use your suggested structure, I actually get a 204 response, but no change within Podio. Could I get an example of what a proper request would look like? The only inputs will be: 

    1) The "Investor" item id (in the 'company' app)

    2) The "Company" item id (in the 'company' app)

    The investor field (relationship field) within the company item needs to be updated to link to the investor item. It maybe should be noted that both items are in the same app?

    Basically, could I get an EXAMPLE of the entire request (with mock IDs)? This one thing has been an obstacle many times and I keep coming back to it. I really appreciate the help.

    0
    Comment actions Permalink
  • Marek Hruzik

    204 in the response means that item values did not change. Are you sure that you are trying to set a new value?

    Here is an example of series of requests to my test app:

    1. Set 2 related items:

    PUT /item/381985274/value/115981312 HTTP/1.1
    Accept: application/json
    Authorization: Bearer (secret)
    Content-Type: application/json; charset=utf-8
    User-Agent: HTTPie/0.9.1

    [
    {
    "value": 385598611
    },
    {
    "value": 365002670
    }
    ]

    HTTP/1.1 200 OK
    Content-Type: application/json; charset=utf-8
    {
    "revision": 16,
    "title": "Marek"
    }

    Response status is 200. Received a revision number.

    2. Set 2 related items (same request with the same values!):

    PUT /item/381985274/value/115981312 HTTP/1.1
    Accept: application/json
    Authorization: Bearer (secret)
    Content-Type: application/json; charset=utf-8
    User-Agent: HTTPie/0.9.1
    [
    {
    "value": 385598611
    },
    {
    "value": 365002670
    }
    ]

    HTTP/1.1 204 No Content

    Response status is 204. This means there was no change.

    3. Set 1 related item:

    PUT /item/381985274/value/115981312 HTTP/1.1
    Accept: application/json
    Authorization: Bearer (secret)
    Content-Type: application/json; charset=utf-8
    User-Agent: HTTPie/0.9.1

    [
    {
    "value": 385598611
    }
    ]

    HTTP/1.1 200 OK
    Content-Type: application/json; charset=utf-8

    {
    "revision": 17,
    "title": "Marek"
    }

    Response status is 200. Received new revision number.

    br
    Marek

    0
    Comment actions Permalink
  • Samson Burton

    There. Finally working. Thank you so much! Very helpful

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk