Call Creatio Rest API from Business Process

I need to invoke Creatio Rest API from a Business Process to take advantage of out-of-the-box functions available via Creatio API.

For example I need to create a copy of a given Project. I saw that the "copy" button of the user interface invoke this endopint: /0/rest/ProjectUtilitiesService/CopyProjectWithStructure

The payload is like {"projectId": "54df197d-7708-4c6d-8dea-778465bec49d"}.

The response is like {"errorInfo":null,"success":true,"nextPrcElReady":false,"queryId":null,"responseStatus":null,"rowsAffected":-1,"CreatedProjectId":"0198cd7d-75b4-4924-8b06-49e2acbcb8cf"}

I need to do the same thing of the "copy button" inside a business process so I configured a web service (standard Web Service section) setting the endpoint and Basic Authentication (Supervisor username with its password set in custom system settings).

When I try the web service I get an "Unauthorized" response:

How should the web service be set to be used "from Creatio to Creatio"?

Is there a better way to reach the same goal from Business Processes?

 

Thanks

Like 1

Like

2 comments
Best reply

Have you tried just calling the classes directly as classes? There's no need to call as a service since it's just a C# class that you can call directly. Or bypass the ProjectUtilitiesService, which is just a service wrapper around ProjectCopyManager and try calling that instead.

Something like (not tested):

var copyManager = new ProjectCopyManager(UserConnection);
copyManager.CopyProjectWithStructure(projectId);

Ryan

Have you tried just calling the classes directly as classes? There's no need to call as a service since it's just a C# class that you can call directly. Or bypass the ProjectUtilitiesService, which is just a service wrapper around ProjectCopyManager and try calling that instead.

Something like (not tested):

var copyManager = new ProjectCopyManager(UserConnection);
copyManager.CopyProjectWithStructure(projectId);

Ryan

Ryan Farley,

Thanks Ryan, it works; here's my code inside a script task:

var copyManager = new Terrasoft.Configuration.ProjectCopyManager(UserConnection);
Guid newProjectId = copyManager.CopyProjectWithStructure(projectId);

 

Show all comments