Cannot Create Group via GraphQL API

While exploring the GraphQL API, I have encountered a problem in making a group in a specific board:

The board query returns the board_id as an ID! , while the create_group expects the board_id as an Int! .
When I try to send my board_id as an Int! , I get a message that my library cannot coerce the number to an Int! .
When I try to send my board_id as an ID!, I get a type mismatch message between my variable (ID!) and the board_id argument (Int!).

How do I create a group in a specific board via the GraphQL API ?

Hello @RevivePhill and welcome to the community!

I hope you like it here :muscle:

GraphQL wise:
You can use a boards query:

{
  boards(limit: 5) {
    name
    id
  }
}

Which will give you the ID as a string:

      {
        "name": "My board",
        "id": "1234567890"
      }

You can then use a mutation like this one, passing the board ID that you got as a numeric value:

mutation {
  create_group(board_id: 1234567890, group_name: "My group") {
    id
    title
  }
}

Script wise when using variables:
You can take the ID you got as a string, turn it into a numeric value and pass the board ID as an Int!:
mutation ($boardId: Int!) {...}

Let me know if that helps!

If it doesn’t, please send over you script so we can take a look!

Cheers,
Matias

Hello @Matias.Monday , thank you.

What you have described is exactly what I am doing, but I did not realize the the ID is returned as a string instead of a numeric. I have made that change in my code, and the error is gone. Thank you for your guidance.

Hello @RevivePhill,

Glad to help!

Let us know if you need anything else :slightly_smiling_face:

Cheers,
Matias

Following up on this, I’m running into the same problem again. I’ve changed how I’m using the python library (building queries dynamically instead of pre-written queries with variables), and it’s once again giving me the error:

Int cannot represent non 32-bit signed integer value

I have been able to track through some reports on the library itself, as well as the GraphQL specification documents, and have found that my library is correct, and that Monday’s implementation is out of spec:

The Int scalar type represents a signed 32-bit numeric non-fractional value.

I’m going to raise a bug with my library’s maintainers as well, but I don’t think they’re going to make changes that are outside of the specification.

What is the process for requesting a change on your side to bring Monday’s API back into specification?

Hello there @RevivePhill,

In this case, I believe the issue lies in your library or script.

Our API works well with Python and we have multiple users using it regularly with this language and they are not encountering this issue.

I would advise to contact the team that maintains your library as you said and check with them what can be done, because again, it appears that the issue is not coming from monday since it would probably be an issue for all Python users if it was.

Cheers,
Matias