I would like to know if it is possible to make calls using the purecloud api on serverSide, and what would be the best practice?
Yes, see the auth code and client credentials grants depending on your use case: https://developer.mypurecloud.com/api/rest/authorization/index.html#authorization_types
Note that you cannot create a server side application, that will generate calls outside of a user context.
What this means is that you cannot create a server application, that will use client credentials, and that will generate calls like an outbound dialer.
The generation of a call is reserved to users.
So as Tim mentioned, you would need to implement an Autorization Code Grant type of credentials (if you want it "server-side") - given that a user/agent will have to authenticate/login with his own credentials via a webpage/webform to get a code, that will be then used by the server side application to get an access token out of it (calls can then be generated on behalf on that user).
But this is while the user who authenticated is logged in.
If the goal is just to create a server-side outbound dialer/call generator (not related to a user/agent) - then it is not possible.
You have to use Outbound Campaigns to get calls generated outside of user context.
Hi jerome
what I need is to create a WebApi that makes the calls, is that possible ??
Yes, you can make a call, as long as it is done in the context of a user.
It means you need to get your access token with: Implicit Grant or with Authorization Code Grant.
The Implicit Grant is a single-step authentication process where a user authenticates with PureCloud and the client application is directly returned an access token. This option provides less security for the access token than the authorization code grant, but is ideal for client-side browser applications (i.e. JavaScript) and most desktop applications (e.g. .NET WPF/WinForms or Java desktop programs).
See here for more details: https://developer.mypurecloud.com/api/rest/authorization/use-implicit-grant.html
The Authorization Code Grant is a two-step authentication process where a user authenticates with PureCloud, then the client application is returned an authorization code. The client application uses the authorization code to make an unauthenticated API request to get an access token. The access token can then be used when making authenticated API calls. This is the most secure option and ideal for websites where API requests will be made server-side (e.g. ASP.NET or PHP) and some desktop applications where a thin client would authorize the user and pass the auth code to a back-end server to exchange for an auth token and make API requests.
See here for more details: https://developer.mypurecloud.com/api/rest/authorization/use-authorization-code.html
In your case, I assume that what you define as "WebApi" means that the request is issued from a server (and not from the web client).
So the only possibility is to use the Authorization Code Grant.
The access token obtained via Client Credentials Grant WILL NOT allow you to make calls.
See here for more details: https://developer.mypurecloud.com/api/rest/authorization/use-client-credentials.html
See here for tutorials - there are some showing how to get the access token in the different models.
https://developer.mypurecloud.com/api/tutorials/index.html
Can i make a call using a token and specify the agent that will make the call and the destination number ??
Hello,
No, it is not possible.
The id/reference of the agent making the call comes from the authentication process.
When you authenticate with Implicit Grant or Authorization Code Grant methods, this is done providing credentials of a user.
The access token will be linked to that user.
So when a request to make a call is made, the PureCloud platform will automatically use that agent/user as the originator of the call.
Regards,
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.