cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Bookmark
|
Subscribe
|
3234
Views
5
Helpful
4
Replies

"The requested resource could not be found" via curl

László
Cisco Employee
Cisco Employee

This is the first bot I'm working on. I got my bot ID and bearer. I'm using them as follows:

BOTB=thelongbearerstring
BOTID=thelongidstring
MESSAGE="hello world"
curl --silent \
--show-error \
-X POST https://webexapis.com/v1/messages \
--header "Authorization: Bearer $BOTB"
--header "Content-Type: multipart/form-data" \
--form "roomId=$BOTID" \
--form "markdown=*$MESSAGE*"

 This returns the following error message:

{"message":"The requested resource could not be found.","errors":[{"description":"The requested resource could not be found."}],"trackingId":"ROUTER_****"}%

 If I use an exiting bots details the curl works, no errors. 

3 Accepted Solutions

Janos Benyovszki
Cisco Employee
Cisco Employee

@László I might be reading this wrong, but based on your description it looks like that your bot is trying to send a message to itself? You are using the bot ID as the room ID and then you are POSTing a message to that room ID using the bot's access token? I just tested the below and that worked for me:

curl --request POST \
  --header "Authorization: Bearer ACCESS_TOKEN" \
  --form "roomId=ROOM_ID" \
  --form "text=example" \
  https://webexapis.com/v1/messages

Also, the room ID is not the same as the people ID, you will need to look it up here https://developer.webex.com/docs/api/v1/rooms . 

View solution in original post

This command showed me what I need. Good!

curl --silent -X GET "https://webexapis.com/v1/rooms" --header "Authorization: Bearer $ACCESS_TOKEN"

View solution in original post

@László szívesen! About finding the room ID in the Webex client. It will be a bit trickier, because the clients only use the unencoded UUID of a room, while the APIs are using encoded UUIDs. You can get the UUID in the Webex client like this:

On Windows use Ctrl + Shift + K
On Mac use Option + Command + K

You can still convert a unencoded UUID into an encoded API ID like this:

  • get the ID of a random room that you are a member of with https://developer.webex.com/docs/api/v1/rooms/list-rooms
  • decode the ID using base64 (it will be something like this ciscospark://us/ROOM/d2fde090-9d0c-11e5-aeed-2176fdcd8a58)
  • replace the part after ROOM/ with your unencoded UUID from the Webex client
  • base64 encode it to get something like this Y2lzY29zcGFyazovL3VzL1JPT00vZDJmZGUwOTAtOWQwYy0xMWU1LWFlZWQtMjE3NmZkY2Q4YTU4

 

View solution in original post

4 Replies 4

Janos Benyovszki
Cisco Employee
Cisco Employee

@László I might be reading this wrong, but based on your description it looks like that your bot is trying to send a message to itself? You are using the bot ID as the room ID and then you are POSTing a message to that room ID using the bot's access token? I just tested the below and that worked for me:

curl --request POST \
  --header "Authorization: Bearer ACCESS_TOKEN" \
  --form "roomId=ROOM_ID" \
  --form "text=example" \
  https://webexapis.com/v1/messages

Also, the room ID is not the same as the people ID, you will need to look it up here https://developer.webex.com/docs/api/v1/rooms . 

Köszönöm szépen! 

This has helped, thank you!

Do you know how can I find out a room's ID in Webex? I tried "Copy Space Link" but that's not it.

Screen Shot 2022-07-27 at 10.05.10.png

@László szívesen! About finding the room ID in the Webex client. It will be a bit trickier, because the clients only use the unencoded UUID of a room, while the APIs are using encoded UUIDs. You can get the UUID in the Webex client like this:

On Windows use Ctrl + Shift + K
On Mac use Option + Command + K

You can still convert a unencoded UUID into an encoded API ID like this:

  • get the ID of a random room that you are a member of with https://developer.webex.com/docs/api/v1/rooms/list-rooms
  • decode the ID using base64 (it will be something like this ciscospark://us/ROOM/d2fde090-9d0c-11e5-aeed-2176fdcd8a58)
  • replace the part after ROOM/ with your unencoded UUID from the Webex client
  • base64 encode it to get something like this Y2lzY29zcGFyazovL3VzL1JPT00vZDJmZGUwOTAtOWQwYy0xMWU1LWFlZWQtMjE3NmZkY2Q4YTU4

 

This command showed me what I need. Good!

curl --silent -X GET "https://webexapis.com/v1/rooms" --header "Authorization: Bearer $ACCESS_TOKEN"