Hello community, I want to create API Service from creatio that return object data with the detail (json with hierarchical data). lets say i want to get 'Account' with Orders, Lead, and else that connected with 'Account' in one endpoint.
I think about create Custom web services, anyone have script with similar case or have suggestion for this case?
You'll just need to design the objects you're returning and make it something like this:
[DataContract]publicclass OrderPayload
{[DataMember(Name ="id")]public Guid Id { get; set;}[DataMember(Name ="Number")]public string Number { get; set;}}[DataContract]publicclass AccountPayload
{[DataMember(Name ="name")]public string Name { get; set;}[DataMember(Name ="orders")]public List<OrderPayload> Orders { get; set;}}
Then you populate that as needed in the webserivce. The AccountPayload is the top level of the objects, so that is what the method would return. You'd populate like this (obviously from some data you read from an ESQ etc):
var account =new AccountPayload();
account.Name="Some account";
account.Orders=new List<OrderPayload>();
account.Orders.Add(someOrder1);
account.Orders.Add(someOrder2);// now return account
Hope this helps get you started in the right direction.
You'll just need to design the objects you're returning and make it something like this:
[DataContract]publicclass OrderPayload
{[DataMember(Name ="id")]public Guid Id { get; set;}[DataMember(Name ="Number")]public string Number { get; set;}}[DataContract]publicclass AccountPayload
{[DataMember(Name ="name")]public string Name { get; set;}[DataMember(Name ="orders")]public List<OrderPayload> Orders { get; set;}}
Then you populate that as needed in the webserivce. The AccountPayload is the top level of the objects, so that is what the method would return. You'd populate like this (obviously from some data you read from an ESQ etc):
var account =new AccountPayload();
account.Name="Some account";
account.Orders=new List<OrderPayload>();
account.Orders.Add(someOrder1);
account.Orders.Add(someOrder2);// now return account
Hope this helps get you started in the right direction.