Sending Data to Monday.com GraphQL API with API Connector

I am looking to send a request with two dynamic fields for my users to input a link and their email the Monday.com API which uses GraphQL and. This data is then sent to create an item in Monday.

[https://monday.com/developers/v2#using-grpahql-section-operations]

Following the advice of Bubble, I have create a GraphQL request that works in Postman, but have been unable to find any documentation on how to send a GraphQL request with dynamic fields. With GraphQL becoming more commonly used by API developers, this would be useful. Wondering if anyone has any insight or has done similar?

I’ve attached the query I am using below.

mutation {create_item (board_id: 428943437, group_id: "topics", item_name:"Test POST (ignore)", column_values:"{ \"owner\": \"nicholas.c@example.com\", \"gsheets_link\": \"google.com\"}") {id}}
3 Likes

Hey @nicholas.c did you find a solution? Any chance you can share here the solution?

1 Like

@defaria.anthony Now I’m wondering did you find a solution? Stuck on the same thing…

Any chance you could share the solution here

In the API connector, you’ll want to do something like this:

  • Select JSON as the data type.
  • Add a Content-Type header with a value of application/json (if a plugin, add this as a shared header).
  • Add an Authorization header per Monday.com’s instructions.

Now, the body. It will probably look something like this:

{
  "query": "mutation { create_item( board_id: 428943437, ... }"
}

You can get a bit fancier with variables. I don’t know the Monday.com GraphQL schema so here is a contrived example:

{
  "query": "mutation LoginWithEmail($password: String!, $email: String!) { loginWithEmail(password: $password, email: $email) { accessToken } }",
  "variables": {
    "email": <email>,
    "password": <password>
  }
}

Note that you do not need to include the \n line break in the strings (and also, you cannot put line breaks in a string anyway in JSON).

If you are using something like the Apollo Sandbox, you can run your GQL through an online site like this to strip the new lines and compact the space:

https://www.gillmeister-software.com/online-tools/text/remove-line-breaks.aspx

Hope this helps.

1 Like