API calls in custom component are failing for external users

Hello,

I have developed a custom component using remote module. its working fine for internal users.. but when I logged in as external user, all the APIs of my custom component are failing with 404 status code..

How do I fix this? TIA

Like 0

Like

1 comments

Configuration services for external users need to have two changes:

First of all, the C# service itself needs to have the following attributes on the class:

DefaultServiceRoute]
[SspServiceRoute]

You'll likely also need to add the using directives: 

using Terrasoft.Web.Common;
using Terrasoft.Web.Common.ServiceRouting;

Second of all, the url path to the service is different for external users. 

Full Creatio (internal) users will use: 

0/rest/UsrMyService/SomeMethod

External users will use: 

0/ssp/rest/UsrMyService/SomeMethod

You can use the following code, if needed, to get the correct path/url based on the user type, it will return the correct path for both user types: 

var workspaceBaseUrl = Terrasoft.utils.uri.getConfigurationWebServiceBaseUrl();
 
var servicePath = workspaceBaseUrl + "/rest/UsrMyService/SomeMethod";
 
//servicePath will now contain the correct URL for either user type

Ryan

Show all comments