Web Services call using JSON

Guys,

We need to create a Web Services call using JSON to create a board on Monday.
For that we need a script to insert in our tool, as shown in the example below!

MicrosoftTeams-image (1)|423x500

MicrosoftTeams-image

Hi @taynna.vieira, welcome to our community!

Apologies for the delay, just catching up from the weekend. It looks like you’re looking to utilize the monday.com API to create a board, right?

In this case, you would most likely need to call the monday.com API endpoint: https://api.monday.com/v2/.

Make sure you include the Content-Type and Authorization headers in your request as well!

Try this out and let me know if you have any other questions.

1 Like

Hi @Helen thank you for your answer.

I added a print screen of my software, so you can see what Im doing the Json configuration.

Could you help me with the script like Json Script Example?:Json Script Example

Hi @taynna.vieira,

Really quickly: I would definitely caution against posting sensitive keys such as your app_secret and app_key information, as these are powerful and can be used to access sensitive data.

On the same note, I do see that your setup seems to be missing the “Authorization” header, which in this case I’m assuming will be your API token. Are you able to put this in the Header somewhere?

Regarding the request body, I believe it should look something like this:

{ "query" : "query { boards (ids: 12345) { items {id} } }" }

This would be the format of a JSON request body!

1 Like

Hi @Helen, How are you? Thank you for your help

I have created this sequence, but still not working.
Could you check again, please?

{​​
“Authorization”: “my_key”,
“create _Item” [
{​​
“board_id”: “1227493769”,
“group_id”: “Teste NPO”,
“item_name”: “New Item”,
“column_values”: “$column_values”
}​​
}​​
]
}​​

Thanks a million.

Hi @taynna.vieira!

I think it’s definitely worth reaching out to the other software’s team and asking if the format we’re using is correct.

I think you may need to include the query in the “param”: section, but I’m not sure that this is where it’s supposed to go.

What platform are you using?

@Helen

We changed the code again, but it still return a error message “Not Authenticated”

Can you help me?

{​​​​​​​
“Authorization”: " key number",
const mutation = `
“mutation” {​​​​​​​
“create_item”(“board_id”: “1227493769”, “item_name”: “a new item”, “column_values”: “{​​​​​​​"check”: {​​​​​​​"checked": “true”}​​​​​​​}​​​​​​​") {​​​​​​​
“create_item” (
“board_id”: “$boardId”,
“group_id”: “$groupId”,
“item_name”: “$itemName”,
“column_values”: “$columnValues”,
) {​​​​​​​
“id”
}​​​​​​​
}​​​​​​​
}​​​​​​​

{​"errors": ["Not Authenticated"]}​

Hi @taynna.vieira!

Hmm if you try the same mutation string in the Developers Playground here, do you see the same issue?

Perhaps you accidentally regenerated a new API token and haven’t had a chance to switch it over yet?

Does the API key you’re using have permissions to add new items to this board, and make changes to the Check column?

Hi @Helen. How are you?

{
“Authorization”: " key number",
“query”:“mutation {\r\ncreate_board(board_name: “NPO2”, board_kind: public, template_id: 1248758150){ id } }”
}

We have done the code for the call, but now we are receiving this error:
{“errors”: [“Not Authenticated”]}

Would you know what to put in the “header” to do the authentication ?

Hi @taynna.vieira,

I believe the authorization header should look something like this (if you’re using your API token):

'Authorization': 'Bearer *your_key_here*'

Could this help?

like this one?

{
“Authorization”: ‘Bearer ‘my_key’’,
“query”:“mutation {\r\ncreate_board(board_name: “NPO2”, board_kind: public, template_id: 1248758150){ id } }”
}

I would definitely give that a try!

Were you able to connect with the other platform’s team? What did they say about authorization header formatting?

Are you still seeing authentication errors in the monday Try It Yourself area?

We tried in " try it yourself area" but it not worked.

The code still like that:

{
“Authorization”: “my_key”,
“query”:“mutation {\r\ncreate_board(board_name: “NPO2”, board_kind: public, template_id: 1248758150){ id } }”
}

and the error returned is this one:
error

@taynna.vieira

Just to make sure we’re on the same page here, when you say you’ve tried this in the try-it-yourself page, but it didn’t work, am I correct to assume that you’ve received the same “Not Authenticated” error?

Would you be able to try and re-generate the monday.com API key you are attempting to use, in that case, and attempt the try-it-yourself page again? Each admin on the account has their own API token – make sure to keep this safe! To generate your API token:

  1. Log into your monday.com account.
  2. Click on your avatar in the bottom left corner.
  3. Select Admin.
  4. Select “API” on the left side of the admin page.
  5. Scroll down to the “API V2 Token” section, and click “Generate”.
  6. Copy this token. This is what you should be looking at:

|autoxauto

API for non-admins users

If you are not an admin of your monday.com account, you can get your API tokens via the developers section, following these steps:

  • Go to your avatar menu
  • Select “developers”
  • Click “My Tokens” in the top

|autoxauto

I would love to hear from you if that helped!

-Alex