question

Alex Rogers avatar image
Alex Rogers asked Alex Rogers commented

Why do I get an 404 error when fetching profile-images?

I'm using the .Net API. Using Fiddler I can see the requests clearly. My notes

I fetch an extension's details: C#:
ext = await r.RestClient.Restapi().Account().Extension(id).Get()

Fiddler:
https://platform.ringcentral.com/restapi/v1.0/account/~/extension/803791067

The result includes a profileImage, ie: uri=https://platform.ringcentral.com/restapi/v1.0/account/574962067/extension/803791067/profile-image

But when I request the image then we get a failure: C#: picBytes = await r.RestClient.Restapi().Account().Extension(id).ProfileImage().Get();

Fiddler: https://platform.ringcentral.com/restapi/v1.0/account/574962067/extension/803791067/profile-image

But it returns a "404" error:

HTTP/1.1 404 Not Found

{ "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" }

Surely this isn't right, is it? Because of these "404" results then it prevents my application from "graduating". Am I doing something wrong?

rest apipresence
1 |3000

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

Phong Vu avatar image
Phong Vu answered Phong Vu commented

You wrote the "404" results prevents your application from "graduating" but the API url you posted is the url for production environment (https://platform.ringcentral.com/restapi/v1.0/account/~/extension/803791067)

Using the .Net SDK on sandbox environment, you need to set the correct platform when creating the SDK instance. I.e 'https://platform.devtest.ringcentral.com'

4 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.

@Phong Vu Thanks. Yes, you can disregard my comments about "graduating". Because I was getting the "404" errors, it did (past tense) stop us graduating. So I remove the "fetching images" bit from our code. As a result the application then passed (graduated) and hence I then went on to documente the problem on the production environment.

The problem is still happening. I can't seem to get the images using the SDK, on the Sandbox or on Production. Does "404" signify that the user supposedly has no picture? If so, it's a shame that it returns an error ("404") and not something nicer, like a "204 No Content".

0 Likes 0 ·

So your application is already graduated? What is the app client id?

Also, the error message in the result is not about the profile image was not found. It says "Resource for parameter [extensionId] is not found". So it seems the provided "extension id" is invalid.

0 Likes 0 ·

@Phong Vu Thanks. It's: Gg5FnfxXQVaI4qfNcttVoA Note: When testing, I tried it with and without the AccountId parameter. My first post actually (mitakenly) has traces from both with and without, mixed together.

0 Likes 0 ·

I found your app in production and your production account. The account id and extension id in your url are also valid. Can you call the API again and print and share the exact result.

I also found that the app is a public app and was created and published by another account, which is a trail account and has already expired. Make sure you login the app with the right production account.

0 Likes 0 ·
Alex Rogers avatar image
Alex Rogers answered Alex Rogers commented

Hi @Phong Vu

Thanks again. I have added the new traces below.

I'm not really sure about your second comment. Could this be why the problem is now happening? The same code used to work when it was written.

I created and registered the app using the first (trial) account. But then as you say, I have got a new, different production account. I thought I would carry on using the first account as just like a "developer" account, that I only accessed to edit/publish the app. And I'd use my new account for real calls, etc. Is that now how it works? Should I move/recreate the app under my new account?

Regards Alex

== Traces:

 GET https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~ HTTP/1.1
 X-User-Agent: Unknown/0.0.1 RingCentral.Net/5.2.0
 Authorization: Bearer [redacted]
 Host: platform.ringcentral.com
 --
 HTTP/1.1 200 OK
 Server: nginx
 Date: Tue, 03 May 2022 17:37:01 GMT
 Content-Type: application/json;charset=utf-8
 Content-Length: 6601
 Connection: keep-alive
 RCRequestId: a3ce4e7e-cb07-11ec-b618-005056b5c469
 RoutingKey: ZRH01P32PAS03
 Content-Language: en-GB
 Vary: Accept-Encoding, User-Agent
 X-Rate-Limit-Group: light
 X-Rate-Limit-Limit: 50
 X-Rate-Limit-Remaining: 48
 X-Rate-Limit-Window: 60
    
 {
   "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/574962067/extension/1005430067",
   "id" : 1005430067,
   "extensionNumber" : "323",
   [REDACTED]
   "profileImage" : {
     "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/574962067/extension/1005430067/profile-image"
   },
   "account" : {
     "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/574962067",
     "id" : "574962067"
   },
   "hidden" : false
 }
 ==
 GET https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~/profile-image HTTP/1.1
 X-User-Agent: Unknown/0.0.1 RingCentral.Net/5.2.0
 Authorization: Bearer [Redacted]
 Host: platform.ringcentral.com
 -
 HTTP/1.1 404 Not Found
 Server: nginx
 Date: Tue, 03 May 2022 17:37:01 GMT
 Content-Type: application/json;charset=utf-8
 Content-Length: 289
 Connection: keep-alive
 RCRequestId: a3d88574-cb07-11ec-b618-005056b5c469
 RoutingKey: ZRH01P32PAS03
 Content-Language: en-GB
 X-Rate-Limit-Group: medium
 X-Rate-Limit-Limit: 40
 X-Rate-Limit-Remaining: 38
 X-Rate-Limit-Window: 60
    
 {
   "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"
 }
 ==
 GET https://platform.ringcentral.com/restapi/v1.0/account/574962067/extension/1005430067/profile-image HTTP/1.1
 X-User-Agent: Unknown/0.0.1 RingCentral.Net/5.2.0
 Authorization: Bearer [Redacted]
 Host: platform.ringcentral.com
 -
 HTTP/1.1 404 Not Found
 Server: nginx
 Date: Tue, 03 May 2022 17:40:09 GMT
 Content-Type: application/json;charset=utf-8
 Content-Length: 289
 Connection: keep-alive
 RCRequestId: 1399ae6a-cb08-11ec-b905-005056b58c8b
 RoutingKey: ZRH01P32PAS01
 Content-Language: en-GB
 X-Rate-Limit-Group: medium
 X-Rate-Limit-Limit: 40
 X-Rate-Limit-Remaining: 37
 X-Rate-Limit-Window: 60
    
 {
   "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"
 }
2 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.

Ok, first of all, now I found out that this issue is related to another known issue that the RC app does not share the user profile image with the RingCentral RESTful platform. This leads to the situation that the extension you are reading does not have the image resource at all. While I would agree with you that the response code should be better 204 rather than 404. But I think the 404 really means the image resource was not created at all, NOT just the image was not found.

There is a request to sync the RC app user profile image with the Platform profile image resource, and it is currently under process. I have no ETA when this would be available though.

To verify this, you can install (if not yet installed) the RingCentral soft phone, login with that user credentials and upload a user profile image. Then read the image using the API. You can also upload a user image using the API, then read it. The user profile image will get updated only on the RingCentral soft phone, NOT the RC app though because of the issue mentioned above.

For your app, it works this way too because your app is a public app. But if your intention is not to build an app for all RingCentral customers, then it should be a private app. A private app will allow only users under the account (company) which owns the app to access and use it. While a public app will serve all users from all other RingCentral accounts (companies).

0 Likes 0 ·

@Phong Vu Thanks again for your help with this. That all makes sense then.

It's a shame about the 404, especially as it was an obstacle to graduation, but it's ok once you realise the way it works especially with the RC user profile image.

And yes, it is intentionally a public app as the intend to share it with others.

0 Likes 0 ·

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