question

jason4335 avatar image
jason4335 asked anton-nikitin commented

Resource for parameter [extensionId] is not found - SMS Send - With Password Flow


Body Response:


{ "errorCode" : "CMN-102", "message" : "Resource for parameter [extensionId] is not found", "errors" : [ { "errorCode" : "CMN-102", "message" : "Resource for parameter [extensionId] is not found", "parameterName" : "extensionId" } ], "parameterName" : "extensionId" }


Header Response:


X-Rate-Limit-Window : 60

Status_Code : 404

RoutingKey : SJC11P01PAS01

Http_Version : HTTP/1.1

Explanation : Not Found

Connection : close

Content-Language : en-US

Date : Tue, 13 Mar 2018 03:10:55 GMT

X-Rate-Limit-Group : medium

Server : nginx/1.10.2

RCRequestId : 2533297a-266c-11e8-a77d-005056bb26b9

Content-Type : application/json;charset=UTF-8

X-Rate-Limit-Limit : 40

X-Rate-Limit-Remaining : 39

Content-Length : 289


My Code:


<cfset base_url = "https://platform.devtest.ringcentral.com/restapi/"; />


<cfset authorization = setTokenType & " " & setAccessToken />


<cfset ringcentralSMS.to = "to number" />

<cfset ringcentralSMS.from = "from number" />

<cfset ringcentralSMS.text = "This is a test text." />


<cfset body = '{ "to": [{"phoneNumber": "#ringcentralSMS.to#"}], "from": {"phoneNumber": "#ringcentralSMS.from#"}, "text": "#ringcentralSMS.text#" }' />


<cfhttp

method="post"

url="#base_url#v1.0/account/~/extension/~/sms"

resolveurl="no"

getasbinary="never"

charset="utf-8"


>


<cfhttpparam type="header" name="content-type" value="application/json">

<cfhttpparam type="header" name="authorization" value="#authorization#">


<cfhttpparam type="body" value="#body#">



</cfhttp>








sms and text messaging
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

anton-nikitin avatar image
anton-nikitin answered
ColdFusion server by some reason escapes tilde character so backend receives request like "/restapi/v1.0/account/%7E/extension/%7E/sms". Can you turn off escaping? 
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

jason4335 avatar image
jason4335 answered anton-nikitin commented
I updated the code...is it passing the tilde character now, because I'm getting this:

{ "message" : "Method Not Allowed", "errors" : [ ] } 

X-Rate-Limit-Window : 60
Status_Code : 405
RoutingKey : SJC11P01PAS01
Http_Version : HTTP/1.1
Explanation : Method Not Allowed
Connection : close
Content-Language : en-US
Date : Tue, 13 Mar 2018 20:41:25 GMT
X-Rate-Limit-Group : medium
Server : nginx/1.10.2
RCRequestId : e5a096e2-26fe-11e8-b818-005056bb26b9
Content-Type : application/json;charset=UTF-8
X-Rate-Limit-Limit : 40
X-Rate-Limit-Remaining : 39
Content-Length : 56
9 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

anton-nikitin avatar image anton-nikitin commented ·
Apparently because you are sending something like "POST /restapi/v1.0/account/&" which doesn't exist. I would recommend you to check raw API request/response before asking in order make it more efficient.
0 Likes 0 ·
jason4335 avatar image jason4335 commented ·
Ok, my link is outputted by my server when it builds the link and it looks like this before it's used to make the request from your server:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/101/sms

Are you saying I have the wrong link to send an SMS? Are you saying it's still escaping the tilde?  

What is the account or account_Id and where do I find that in my Developer Console and User Account, so I can remove the tilde and see if that's the problem.    That might be a workaround anyways.  To be frank, it's cleaner code when you are more specific in requests, so it might be better to remove the tilde from the process anyways.

Please understand I making headway on Coldfusion and I am going to have working code that others can use.  

Authorization on Password Flow is working on Coldfusion.

I just need help to get this done...

0 Likes 0 ·
anton-nikitin avatar image anton-nikitin commented ·
You can use tilde if you manage to avoid escaping it by CF. And you can use it instead of both "accountId" and "extensionId" as explained here  https://developer.ringcentral.com/api-docs/latest/index.html#!#Resources.html

So your request should look like 

POST https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/sms
0 Likes 0 ·
jason4335 avatar image jason4335 commented ·
Ok.  Then I have it correct, but on your end the tilde is not being escaped by Coldfusion regardless of what I do, because I am still getting the same error.  By the way, I have never had Coldfusion alter a link....I test the output before it's submitted the RC and it looks identical to the above.

So I need to remove the "tilde" from the equation.  From what I can tell the the account is the "owner_id" which is returned in the jSON response with the token response.  I need someone to confirm that, because everytime someone asks on these forums, the response is "use the tilde" instead.  

Assuming that's correct:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/[OWNER_IDFROMJSONRESPONSE/extension/101/sms

The extension is 101 which is the main line so I know that's right and I am still getting the the same error (so know with or without the tilde):

RESPONSE BODY:

{ "errorCode" : "CMN-102", "message" : "Resource for parameter [extensionId] is not found", "errors" : [ { "errorCode" : "CMN-102", "message" : "Resource for parameter [extensionId] is not found", "parameterName" : "extensionId" } ], "parameterName" : "extensionId" } 

RESPONSE HEADER:

X-Rate-Limit-Window : 60
Status_Code : 404
RoutingKey : SJC11P01PAS01
Http_Version : HTTP/1.1
Explanation : Not Found
Connection : close
Content-Language : en-US
Date : Wed, 14 Mar 2018 01:40:38 GMT
X-Rate-Limit-Group : medium
Server : nginx/1.10.2
RCRequestId : b26c45c6-2728-11e8-ae0d-005056bb26b9
Content-Type : application/json;charset=UTF-8
X-Rate-Limit-Limit : 40
X-Rate-Limit-Remaining : 39
Content-Length : 289

0 Likes 0 ·
anton-nikitin avatar image anton-nikitin commented ·
OK. I feel I will need to cite the text from the link I sent in my previous message:

Let's consider a typical API resource URI:
https://platform.ringcentral.com/restapi/v1.0/account/159048008/    extension/171857008/call-log?dateFrom=2012-08-26

The URI in the example above contains path parameters highlighted in bold. Path parameters are commonly used in the RingCentral API to identify a particular entity belonging to a given type by its unique key. Since most of the API resources represent some objects which are owned by particular a RingCentral account (company) or user, two basic path parameters are accountId and extensionId. They identify the account and extension of a RingCentral user, accordingly.

NoteNote

RingCentral users associate an account with the company main phone number and an extension with the short extension number, but both accountId and extensionId are internal identifiers.

At the same time the typical API usage scenario includes accessing particular resources on behalf of some user whose credentials (phone number, extension number and password) were passed on authentication phase. Thus in this case API enables the simplified syntax of specifying account and extension identifiers in the URI. The tilde symbol (~) can be used as a replacement for both accountId and extensionId if you are going to access data that belongs to account/extension that you are currently logged in to. Considering the example above, if the user successfully authenticated to work with account 159048008 and extension 171857008 the URI to retrieve the same resource may be written as follows:

https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/    call-log?dateFrom=2012-08-26 
So in your case extensionId is not "101". It is internal ID which actually returned in owner_id attribute of token response (if you log in as this user). If you use main line, accountId will be the same as extensionId (but only in this particular case).

I will check what we can do to accept both escaped and unescaped tildes.
0 Likes 0 ·
Show more comments

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys