Assistance with API connection

This post was flagged by the community and is temporarily hidden.

Hello there @abbey-equals and welcome to the community!

I hope you like it here :muscle:

You are sending a GET request and being our API a GraphQL API, you need to send a POST request always (both for queries and mutations).

It seems as you are trying to use our API as if it was a REST API.

With our API, you always use the same endpoint with POST requests and what changes when you want to get or update different information is the body of the request.

You can find our documentation with some great examples here.

Also, as a reference, here is a valid request:

		fetch ("https://api.monday.com/v2", {
 		method: 'post',
 		headers: {
 			'Content-Type': 'application/json',
 			'Authorization' : 'MY_API_KEY'
 		},
 		body: JSON.stringify({
 			'query' : `mutation {change_simple_column_value (board_id: 1234567890 item_id: 1122334455, column_id: "text", value: "This is text") {id}}`,
 		})
 	})

I hope that helps!

Cheers,
Matias

This post was flagged by the community and is temporarily hidden.

Hello again @abbey-equals!

The endpoint you are using is incorrect. Please take into account that this is GraphQL. Not REST API.

You have to always use the same endpoint https://api.monday.com/v2/

Also, pagination does not work with a “per_page” parameter.

Please check our API documentation here and learn more about how to use pagination here.

Also take into account that our API will expect column IDs and not their names. You can check the IDs by going to your admin section, then to “monday.labs”, enabeling developer mode, and then checking the ID of each column in the board by clicking on the 3 dots next to the column’s name.

You can also check our Postman examples here.

Please follow this documentation and those examples in order to send the request correctly.

I hope that helps!

Cheers,
Matias

Thanks - totally get it, appreciate the link to the right endpoints!

Abbey

Hello again @abbey-equals,

Glad to help!

Let us know if you need anything :slightly_smiling_face:

Cheers,
Matias

Hi Matias.

I have simple question. I have 1 parent board and subitem inside.

I want to query parent board 1 table and subitem board with parent’s ID 1 table.

I want to connect to Power BI. I follow this PowerBI/Monday.com M Query at 308233441ac17b72e817280753eb3bc6d6b18ddb · DataMuallem/PowerBI · GitHub and it can connect api but don’t have parent id and don’t have subitem list.

How can I do that ? I don’t have basic coding so can you share me some example.

Thank you very much.

Hello there @suriyapong,

You can use a query like this one to get the ID of one of the subitems in your board:

{
  boards(ids: 1234567890) {
    items {
      subitems {
				id
      }
    }
  }
}

Then you can use that ID in another call to get the ID of the subitem’s board:

{
  items(ids: 1112223334) {
    board {
      id
    }
  }
}

Cheers,
Matias

Hi, @Matias.Monday

Got it. I can get subitem board’s ID and get list subitems and value already.

But there is no parent ID in subitem so I can’t link subitem to parent.

Can you suggest ?
Thank you

Hello again @suriyapong,

You can get the ID of the parent item of any subitem with a query like this one:

{
  items(ids: 1234567890) {
    parent_item {
      id
    }
  }
}

Is this what you were looking for?

Yes, It will be like this but can you suggest PowerBI query. Which I will query the table of subitems with have column like this

parent id, subitem name, subitemvalue1,subitemvalue2,subitemvalue3.

this is I really want. Because I tested it before with

Content=Text.ToBinary("{""query"": ""{ boards (ids: Enter Id) { items { id name column_values { title text } } } }""}")

and id isn’t show after I query it.

the code source I get is from PowerBI/Monday.com M Query at 308233441ac17b72e817280753eb3bc6d6b18ddb · DataMuallem/PowerBI · GitHub

Thank you

Hello again @suriyapong,

I do not have experience with Power BI but on our API’s end, you can use something like this, which will give you the subitem’s name, parent ID and column values.

{
  items(ids: YOURSUBITEMID) {
    name
    parent_item {
      id
    }
    column_values {
      title
      value
      text
    }
  }
}

Thank you so much I will try and come back to you. you are really kind. Thank you