How To create An API in creatio and access in postman
For creating An Api i was tried to create a webservice to retrive an email from employee section in creatio.it was published without any errors
below is the following code.
namespace Terrasoft.Configuration
{
using System;
using System.Configuration;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;
using Terrasoft.Common;
using Terrasoft.Core;
using Terrasoft.Web.Common;
using Terrasoft.Core.Entities;
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class UsrCustomConfigurationService : BaseService {
[OperationContract]
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Wrapped,
RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public string EmployeeDetails(string Name) {
// Default result.
var result = " ";
// The EntitySchemaQuery instance, addressing the Contact database table.
var esq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "UsrEmployee");
var Fname = esq.AddColumn("UsrFullName");
var eid = esq.AddColumn("UsrEmailid");
var esqFilter = esq.CreateFilterWithParameters(FilterComparisonType.Equal, "UsrFullName",Name);
esq.Filters.Add(esqFilter);
// Receiving query results.
var entities = esq.GetEntityCollection(UserConnection);
// If condtion the data received.
if (entities.Count > 0)
{
/* Return the "Id" column value of the first query result record. */
result = entities[0].GetColumnValue("UsrEmailid").ToString();
/* You can also use this option:
result = entities[0].GetTypedColumnValue(colId.Name); */
}
// Return result.
return result;
}
}
}
Now, I am trying to access the webservice API from postman. But it was giving an error. I was attaching the image for reference. Whether I followed correct procedure or not?
If any other procdures to retrieve data.please,help us.
Like
Hello Keerthana Yenagandhula
I made a similar webservices a few weeks ago.
Here's a Creatio article explaining how to do it:
https://academy.creatio.com/docs/7-18/developer/back_end_development/we…
And there is also the walkthrough to test it in Postmain
https://academy.creatio.com/docs/7-18/developer/back_end_development/we…
I hope this will help you.
Vincent
LAVIGNE Vincent,
LAVIGNE Vincent,
In my case, I am facing issue in Postman Issue.could please,help me I am unable to rectify this issue.
Keerthana Yenagandhula,
Hi!
Please review all the headers and ensure that the settings are configured correctly.
Here is the documentation to get acquainted with: https://documenter.getpostman.com/view/10204500/SztHX5Qb?version=latest…
We will be glad to help with any other questions.