[RELEASED] Sub-item API support

Great job on sub-items! This could be hot feature for sure.
Please let us know if they are currently supported by API and if so there documentation available. If there is no API support ATM please let us know when it is planned.

1 Like

Hey @IlyaK!

At the moment subitems are not fully supported by our API. However, each subitem is simply an item on a different board, so you should be able to do many of the current operations via the API with subitems.

The subitem column is a link to item column, and each subitem on a board is pulled from another board. Does that make sense?

1 Like

@dipro, thank you very much for your quick response! it does make sense.
I’ve been able to get a list of sub-items, sub-item ID and its column values, that is fine.
What I would like to be able to do is to have a way to add sub-item via API, that would make them very usable.

For sure! Adding support for the link to item column would be helpful, and is on our roadmap.

1 Like

Hello. I am still having a hard time extracting subitems as i dont follow the above post.
I am trying to get subitems as though they are items using. Is this possible? I am basically looking at monday for content programming

query {
items_by_column_values (board_id: xxxxxx, column_id: “date”, column_value: “03-25-2020”)
{
id
name
}
}

@dipro I was able to find the board id for the sub-items board and add a item directly there, but it doesn’t seem to be updating the parent board. Known issue ?

@jonathon, I have a feeling that the item in the sub-items board is linked to the main board by the mechanism that is used in the ‘link’ column.
So when you create it it appears on the sub-items board but it does not have any relationship to the main board item and it has no fields you could fill for this link to happen. Linking is done via main board ‘subitems’ column, which is basically a multi-item link.
However currently the API does not support updating this column type, so you’re stuck.
Would be great for @dipro to confirm or deny this as it is purely guesswork on my part

1 Like

I have tried to reproduce with the API the equivalent of a subitem created using the UI…almost there I think…but not quite.

First, I retrieved the list of the subitems of an item with the following:

query {
    items (ids: [571529684]) {
    name
    column_values (ids: "subitems"){
            id
            value
        }
    }
}

which returns:

{
    "data": {
        "items": [
            {
                "name": "42751 (GREETING LIFE CO., LTD)",
                "column_values": [
                    {
                        "id": "subitems",
                        "value": "{\"linkedPulseIds\":[{\"linkedPulseId\":573197006},{\"linkedPulseId\":573198135},{\"linkedPulseId\":590011632}]}"
                    }
                ]
            }
        ]
    },
    "account_id": 9999999
}

I checked the details of one of the subitem (573197006) with the following :

query {
    items (ids: [573197006]) {
    name
    board {
        id
    }
    group {
        id
    }
    column_values {
            id
            value
        }
    }
}

which returns:

{
    "data": {
        "items": [
            {
                "name": "highlighter (mild liner)",
                "board": {
                    "id": "573187617"
                },
                "group": {
                    "id": "subitems_of_571529684"
                },
                "column_values": [
                    {
                        "id": "files",
                        "value": "{\"files\":[{\"fileType\":\"ASSET\",\"assetId\":82157211,\"name\":\"42751_mildliner.JPG\",\"isImage\":\"true\"}]}"
                    },
                    {
                        "id": "status",
                        "value": "{\"index\":9,\"post_id\":null,\"changed_at\":\"2020-05-20T01:25:09.435Z\"}"
                    }
                ]
            }
        ]
    },
    "account_id": 9999999
}

I created an new item in the same board and group as the existing subitem

mutation {
    create_item (board_id: 573187617, 
                 group_id: "subitems_of_571529684", 
                 item_name: " sunglasses test vince") {
        id
    }
}

which returns:

{
    "data": {
        "create_item": {
            "id": "590092649"
        }
    },
    "account_id": 9999999
}

At this point I was hopping that the subitem would have appeared in the UI, but that wasn’t the case.

I tried to force it by updating the value of the column “subitems” in the parent item with the following (where 590092649 is the ID of the newly created subitem):

mutation {
    change_column_value (board_id: 562486190, 
                         item_id: 571529684, 
                         column_id: "subitems", 
                         value: "{\"linkedPulseIds\":[{\"linkedPulseId\":573197006},{\"linkedPulseId\":573198135},{\"linkedPulseId\":590011632}]},{\"linkedPulseId\":590092649}]}") {
            id
    }
}

I get a 500 internal server error with an HTML error page containing “We’re currently experiencing some technical issues which our developers are working hard to resolve.”

4 Likes

Thanks for the detailed walkthrough of what you’ve tried Vivi! At the moment creating new subitems are not supported by our API, but we’re working on it.

The subitems column is just a link to item column, so you can use it to query and update the data on existing subitems. That said, this isn’t a fully documented feature so it may not work the way you expect just yet.

Watch this space; I’ll update when this is possible!

Instead of adding a new thread, I wanted to add to this one.

Subitems are key to me getting on the Monday bandwagon. They are often required in the business cases I handle, and can save tons of visible boards, making user navigation feasible for larger use cases.

I know that the APIs for subitems aren’t supported, but I am in a place where I’d like to understand more about the structure for them so I can understand if a problem I’m experiencing is due to my oversight or something that isn’t fully built. I think on the dev side of the world we understand that things aren’t always stable, but knowing where they are today and the direction they are heading can help us plan out approaches.

Basic subitem creations seem to work perfectly through the API, except one interesting glitch. This is similar to the above, and I am curious if the additional motions I’ve managed are due the short time since the OP.

These are the steps I’ve taken, and the outcome:

1: Activate subitems
2: Create parent board and necessary columns
3: Create subitems on board, add necessary columns and a few subitems.
4: Query board list, return IDs
5: Query items in each board
6. Create group on subitem board, if it doesn’t exists (subitems_of_ParentPulseIdHere)
7: Create item on Subitem board under that group, data return provides
8: Just as above, push item into main pulse’s subitem object
**Note: I had to do the following. IDs are made up for this post. I’m pushing from SQL.

I was able to use
{“query”:“mutation{change_column_value(item_id: 654987321, board_id:321987654, column_id:"subitems", value: "{\\\“linkedPulseIds\\\”:[{\\\“linkedPulseId\\\”:123456789},\\\“linkedPulseId\\\”:987654321}]}"){id}}”}
and
{“query”:“mutation{change_column_value(item_id: 654987321, board_id:321987654, column_id:"subitems", value: "{\\\“item_ids\\\”:[123456789,987654321]}"){id}}”}

9 Query item column values to ensure desired effect, then check the screen.

Viola! With the board open, the subitems populate immediately. I can interact with them, and everything is as expected…until I refresh the page.
As soon as the page it refreshed all pulses created via API disappear from view, but still show in queries.

By calling the API twice more with the page open (once with an empty linked string to clear the links, and then with the full statement) the items will show back up on the page. However, as before, once the page is reloaded the API created subitems no longer show.

–Querying the parent board still shows expected nesting within subitem object under all circumstances
–Querying child/subitem board shows expected items, marked active.
–Cross referencing data between manual and API subitems hasn’t shown a redflag that I can find.

Reference:

board_Id Item_ID group_id name subitems status
601229627 601381253 topics Unknown {“linkedPulseIds”:[{“linkedPulseId”:605081179},{“linkedPulseId”:605085259},{“linkedPulseId”:605093289},{“linkedPulseId”:605119841}]} Hold

Only two of those four are displaying when the page is loaded, but this is part of the query return.
It seems I’m missing a value somewhere, and I need help understanding what that value is and how to work past it, or if it is even visible at this time. I have thousands of subitems that I need to create and automate, and doing so manually isn’t an option. This is a make it or break it for including additional workflows and customers.

1 Like

Another update

Little more digging on this:

When subitems are requested by the interface, all are returned from the sub item board:

One the board dataset, the counts are also correct for the groups related to each pulse:

However, on the final visual board, the count references only the actual pulses attached. There’s a key called new_infra, set to yes. The only items visible are those on this portion, with the new_infra key.

After some testing, I’m confident that there is an additional value inside of the subitems column “value” field that isn’t displayed. Here’s why

  1. Manually create subitem. It is visible initially after reloading the page.
  2. API: change parent pulse subitem “value” field to {“linkedPulseIds”:[TypeNothingHere]}, manually created subitem is no longer visible.
  3. API: change parent pulse subitem “value” field to {“linkedPulseIds”:[{“linkedPulseId”:123456789}]} or {“item_ids”:[123456789]}, manually created subitem is now visible again, even after refresh.
  4. API: change parent pulse subitem “value” field to {}, manually created subitem is no longer visible.
  5. API: change parent pulse subitem “value” field to {“linkedPulseIds”:[{“linkedPulseId”:123456789}]} or {“item_ids”:[123456789]}, and manually created subitem fails to stay visible after refresh. Query returns {“linkedPulseIds”:[{“linkedPulseId”:123456789}]} in “value” field.

The API has accepted additional value pairs in the subitem “value” field without returning any errors, and while still populating the linkedPulseIds pairs correctly. I haven’t managed any combination of using “new_infra” that makes the columns visible. I am not sure if these are being stripped by the endpoint, or if they are just displaying. Somewhere not visible to us inside of the subitem column “value” field is the value pair that helps make a subitem visible. I’m hoping Monday will tell us what that pair is, how it is structures, and allow it through the API.

I’m happy to announce, that we just release a “create_subitem” mutation! :partying_face: :partying_face: :partying_face:
You can check it in our documentation: https://monday.com/developers/v2#mutations-section-subitems-create

Moderator edit: We found some issues with the API call and have rolled back the feature. We will update you when it’s back online!

2 Likes

@VladMonday earlier this morning I was able to see the documentation. This afternoon I’ve set time to test, but the documentation isn’t showing. What happened?

This is no longer visible.

@morhriveion, as I understand there was some kind of data quality issue which prevented new mutation from workin properly in some circumstances and so it was removed until the issue will be fixed. I hope someone from Monday team will be able to give more detailed update.
I received an automated email from @dipro regarding this some time ago.

@morhriveion – yes, as Ilya mentioned we had to roll back this mutation to prevent other issues. We are working on bringing it back online as soon as we can! We’ll update when this is done.

2 Likes

Note that using the API to query subitems through the column value will not 100% work for every item. For a few items I receive less subitems than there actually are

@amitozalvo will you share your query?

Request

query {
  boards (ids: [${boardId}]) {
    	columns{
        title,
        id
      }
      items(ids: [${itemId}]) {
        column_values {
          value,
          type,
          id
        }
      }
    }
}

Response

{
  "data": {
    "boards": [
      {
       "items": [
          "column_values": [
              {
                "value": "{\"linkedPulseIds\":[{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX},{\"linkedPulseId\":XXXXXXXX}]}",
                "type": "subtasks",
                "id": "subitems"
              }
            ]
          }
        ]
      }
    ]
  },
  "account_id": XXXXXXXX
}

This query yielded 19 subitems, while there are actually 25 in the board.
I wrote to the support, hoping they will fix this ASAP.
I’ll post an update when they do.

I have edited the response to only show the relevant data. Also, IDs have been replaced with XXXXXXXX

@amitozalvo interesting…are you filtering by pulse ID during your query? If yes, did you try using the item root and calling board/id inside of it without a filter to see what was returned?

{
items (ids: [xxxxx,xxxxx,xxxxx]) {
board {
id
name
}
, id
, name
, column_values {
value
, type
, id
}
}
}

I’ve been trying to get an understanding for Monday’s development on this so I can plan accordingly, but they aren’t really discussing.