1

I'm tring to modify category fields of a contact app using Podio API.

I get the following response for the GET request (https://api.podio.com/app/22768616/field/189304190): (Previously I created the field with a POST request and everything works fine)

{
    "status": "active",
    "type": "category",
    "field_id": 189304190,
    "label": "myCategories",
    "config": {
        "default_value": null,
        "unique": false,
        "description": null,
        "hidden_create_view_edit": false,
        "required": false,
        "mapping": null,
        "label": "myCategories",
        "visible": true,
        "delta": 9,
        "hidden": false,
        "settings": {
            "multiple": false,
            "options": [
                {
                    "status": "active",
                    "text": "Cat1",
                    "id": 1,
                    "color": "DCEBD8"
                },
                {
                    "status": "active",
                    "text": "Cat2",
                    "id": 2,
                    "color": "DCEBD8"
                },
                {
                    "status": "active",
                    "text": "Cat3",
                    "id": 3,
                    "color": "DCEBD8"
                },
                {
                    "status": "active",
                    "text": "Cat4",
                    "id": 4,
                    "color": "DCEBD8"
                }
            ],
            "display": "dropdown"
        }
    },
    "external_id": "mycategories-2"
}

If I send a PUT request to https://api.podio.com/app/22768616/field/189304190 with the same response, the dropdown category field changes to an inline category field and all the options are deleted. (I expected nothing would happen to my field, I also tried to modify the text of the options, but got the same result).

{
    "status": "active",
    "type": "category",
    "field_id": 189304190,
    "label": "myCategories",
    "config": {
        "default_value": null,
        "unique": false,
        "description": null,
        "hidden_create_view_edit": false,
        "required": false,
        "mapping": null,
        "label": "myCategories",
        "visible": true,
        "delta": 0,
        "hidden": false,
        "settings": {
            "multiple": false,
            "options": [
                {
                    "status": "deleted",
                    "text": "Cat1",
                    "id": 1,
                    "color": "DCEBD8"
                },
                {
                    "status": "deleted",
                    "text": "Cat2",
                    "id": 2,
                    "color": "DCEBD8"
                },
                {
                    "status": "deleted",
                    "text": "Cat3",
                    "id": 3,
                    "color": "DCEBD8"
                },
                {
                    "status": "deleted",
                    "text": "Cat4",
                    "id": 4,
                    "color": "DCEBD8"
                }
            ],
            "display": "inline"
        }
    },
    "external_id": "mycategories-2"
}

Could you please help with any example to update a category fields correctly?

daniel-sc
  • 1,139
  • 11
  • 23
desire
  • 11
  • 1

1 Answers1

1

Can you add what the body is when you are using the PUT endpoint?

My guess is that you are somehow not mapping the "settings" parameter correctly. Per the API documentation the settings parameter for a category field should follow this format:

{
  "options": The list of options for the question
  [
    {
      "id": The id of the option, only use this for existing options,
      "status": The current status of the option, "active" or "deleted", only use this to delete options,
      "text": The text for the option (required)
    },
    ... (more options)
  ],
  "multiple": True if multiple answers should be allowed, False otherwise
}
Jake
  • 90
  • 1
  • 10
  • 1
    you were right, I tried to use the same json getting from the get field request, but the json structure of the PUT request is kind of different! Thanks! – desire May 30 '19 at 10:10