Hi Expert ,

    I am trying to use Creatio api with basic authentication . I am following below links :

    https://documenter.getpostman.com/view/10204500/SztHX5Qb#46f97170-d66d-…;

    

    NotWorking in PostMan : As per documention it's not working  in postman. Stored BPMCSRF value from Response Header Cookie of Token Request and call get api with BPMCSRF / ForceUseSession  headers key with it's value .Removed cookies from get request. Send the the get request it's giving a html response without any error details.

    

    Working in PostMan : In PostMan Send Token request then send get request (https://steuler.creatio.com/0/odata/Product?$top=1) without set any Header keys it's working fine. In this scenario i can see token request response header cookie values are sending bydefault by Postman in the get request.

    NotWorking in Consol Application : As per 2nd scenario i am trying to send a Get api request with token generate Response header cookies values but it's showing html error without any error details

    NotWorking in Consol Application : As per documentation Stored BPMCSRF value from Response Header Cookie of Token Request and call get api with BPMCSRF / ForceUseSession  headers key with it's value .But showing html error without any error details.

    i have attached my screen shots for reference.From my side any configuraration need to be changed Creation envionment for that my scenario  Can you give me any proper documents which i can follow and will be worked ?

    below is my console application code :

                // Create HttpClient

                using (HttpClient httpClient = new HttpClient())

                {

                    // Create HttpRequestMessage

                    HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, @"https://steuler.creatio.com/0/odata/Product?$top=1");

                    // Set request headers

                    request.Headers.Add("Accept", "application/json");

                    request.Headers.Add("ForceUseSession", "true");

                    request.Headers.Add("BPMCSRF", "YtuvyS.WPYmW5BChY5anK.");

                    // Send the request

                    HttpResponseMessage response =  httpClient.SendAsync(request).ConfigureAwait(false).GetAwaiter().GetResult();

                    // Check response status

                    if (response.IsSuccessStatusCode)

                    {

                        string responseData =  response.Content.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();

                    }

                 }

 

Thanks and Regards

Surajit Kundu

Like 0

Like

2 comments

I don't see in your code the call to authenticate. I assume that you're previously calling /ServiceModel/AuthService.svc/Login somewhere to get the BPMCSRF value? See https://documenter.getpostman.com/view/10204500/SztHX5Qb#46f97170-d66d-…

Note, the BPMCSRF value doesn't last forever, so it does need to be a recently obtained value. 

This article shows the complete steps for executing requests via Postman which might help: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

Ryan

Ryan Farley,

Hi 

      Thanks for your reply . Below is my token generation code from where i have taken cookies value for my 2nd request .Before i have not attached that token generation part as these is working fine. In postman it's working fine using Cookies based authentication.In my Console application i am sending all the Cookies (BPMLOADER, .ASPXAUTH, BPMCSRF, and UserName) as a Header Key and value in further requests to Creatio services that use cookie-based authentication but it's showing Html Error ?

 static async Task<Dictionary<string, string>> TokenGenerateDictionary()

        {

            var headerCookies = new Dictionary<string, string>();                 

                using (var client = new HttpClient())

                {

                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                    using (var request = new HttpRequestMessage(HttpMethod.Post, @"https://steuler.creatio.com/ServiceModel/AuthService.svc/Login"))

                    {

                        request.Content = new StringContent($"{{\"UserName\":\"ram\",\"UserPassword\":\"abcd\"}}", Encoding.UTF8, "application/json");

                        var response = client.SendAsync(request).Result;

                        var responseString = await response.Content.ReadAsStringAsync();

                        JObject responseJson = JObject.Parse(responseString);

                        int code = (int)responseJson["Code"];

                        if (code == 0 && response.IsSuccessStatusCode)

                        {

                            foreach (string setCookieHeader in response.Headers.GetValues("set-cookie"))

                            {

                                 string[] cookies = setCookieHeader.Split(';');

                                if (cookies.Length > 0)

                                {

                                    string[] keyValue = cookies[0].Trim().Split('=');

                                    if (keyValue.Length == 2)

                                    {

                                        string key = keyValue[0];

                                        string value = keyValue[1];

                                        if (!headerCookies.Keys.Contains(key))

                                            headerCookies.Add(key, value);

                                    }

                                }

                            }

                         }

                    }

                }

            return headerCookies;

        }



Request Get Operation send cookies in Header Key :

         var tokenHeaderCookiesData = TokenGenerateDictionary().ConfigureAwait(false).GetAwaiter().GetResult(); 

         string requestUri = @"https://steuler.creatio.com/0/odata/Product?$top=1";

         using (HttpClient httpClient = new HttpClient())

                {

                    HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUri);

                    foreach (string key in tokenHeaderCookiesData.Keys)

                    {

                        //BPMLOADER, .ASPXAUTH, BPMCSRF, and UserName

                        if (key== "BPMLOADER" || key == ".ASPXAUTH" || key == "BPMCSRF" || key == "UserName")

                           request.Headers.Add(key, tokenHeaderCookiesData[key]);

                    }

                    HttpResponseMessage response =  httpClient.SendAsync(request).ConfigureAwait(false).GetAwaiter().GetResult();

                    string responseData =  response.Content.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();

                }

   



Html Error Response with status OK:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" culture="en-US">

<head><meta http-equiv="X-UA-Compatible" content="IE=Edge" /><meta name="fontiran.com:license" content="LAXSN" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>

    Creatio

</title>

    <style>

        .font-preload {

            position: absolute;

            opacity: 0;

        }

        .font-preload-open-sans {

            font-family: "Bpmonline Open Sans";

        }

        .font-preload-open-sans-light {

            font-family: "Bpmonline Open Sans Light";

        }

        .font-preload-open-sans-bold {

            font-family: "Bpmonline Open Sans Bold";

        }

    </style>

<script type="text/javascript" src="https://steuler.creatio.com//core/8dc3ccad339641a4ecd1ecb0b57f017d/Terr…"></script>

<script type="text/javascript" src="https://steuler.creatio.com/api/ClientScript/GenerateLoginScripts"></script>

<script type="text/javascript" src="https://steuler.creatio.com//core/057665f97324038f6c7c326b6734de6b/requ…" data-main="https://steuler.creatio.com//core/0fbfa51b1de27f89696f0f8d31da5f16/Terr…" async></script>

<script type="text/javascript"></script>

</head>

<body>

    <div class="font-preload">

        <span class="font-preload-open-sans">_</span>

        <span class="font-preload-open-sans-light">_</span>

        <span class="font-preload-open-sans-bold">_</span>

    </div>

    <form name="IndexForm" method="post" action="./NuiLogin.aspx?ReturnUrl=%2f0%2fodata%2fProduct%3f%24top%3d1&amp;%24top=1" id="IndexForm">

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="+mvmSAOrSFVSNU1VvvnnAv5lt45aMHGRIkN033uMqlv/X2Fn2421RrzZayJqLBBTzwEnVTCtLeOrFnkbGP1c32c1p4dJwgJeute2MMWvNkRY1wHA" />

<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="0BFA92C5" />

    </form>

</body>

</html>

 

Thanks 

Surajit Kundu

Show all comments

I have a subprocess that loops the returned records from an API call and adds a new record in a data object. I want to modify the process to check if the record already exists and if so, modify the existing record with the data changes.

Like 0

Like

1 comments

First read the record using whatever Identifier you have on it from the source data. If the record exists the Id value will be a Guid and if it doesn't exist the Id of the record will be Guid.Empty.

So the condition for the update will look like: 

[Id from the Read] != Guid.Empty (this means the Read found the record)

The "else" will proceed to the Add, just make sure you populate some identifying value from the API call that you'll use when you read if the record exists next time.

Ryan

Show all comments

Where does the link to the audio recording of the call attached to the CallCollection appear? Or where can I attach an audio recording of a call via odata 3\4

Like 0

Like

1 comments

Hello!

Audio recording of a phone call can be accessed via Calls section or CTI panel. 

Here is more info: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/platform-customization/classic-ui/telephony-integration/overview

 

Depending on the integrated phone system and specifics of its API (Application Programming Interface), different architectural mechanisms are used. The API also affects available phone integration functions. For example, the call playback function is not available for all phone systems, the web phone is available when integrating with Webitel, etc. Regardless of the phone integration mechanism being used, the CTI panel interface remains the same for all Creatio users.

 

As for ODATA usage, you can get acquainted with the following Community posts that might be useful: https://community.creatio.com/questions/how-upload-attachments-odata https://community.creatio.com/questions/uploading-file-creatio-external-application-odata

Show all comments

Hello,

 

I am trying to automate the gathering of data using some business process that perform API calls to one of our client private APIs. I have defined the WebServices with no problem like the one from this example:

 

 

And sending the test request with a valid API Key and Authorization token works perfectly. However, if I try to group all of this inside a business process I get an error that I don't know how to solve. This is the business process:

 

 

And the error that I get exactly on the web service call is this one:

 

 

The full error message states:

Terrasoft.Common.UnsupportedTypeException: Type "System.Collections.Generic.List`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" is not supported.

 

I have done some tests and I can confirm that the error only appears when I try to use a the valid Authorization token retrieved previously, and if I set any other value in that Web Service parameter I don't get the error but obviously the call fails because I am using and incorrect token.

 

The length of the token is 299 characters and as it is an authorization token, it must be preceded by the word "Bearer", so the full value that I am passing to that parameter is "Bearer " with a total length of 306 characters. I also tested using some random strings of length 500+ and the error doesn't show up, so it is not related to a limit of the parameter length. I also checked that the token I am passing is 'correct', i.e. no breaklines, weird characters (not UTF-8) or anything that could cause problems with the encoding of the string.

 

Therefore, I guess it is something related to the way Creatio builds the API request from inside the process, that is not the same as doing from a test request inside the Web Service...

 

Your help is highly appreciated.

Regards.

Like 0

Like

2 comments

Note: I have not tried yet to perform the same kind of requests inside a business process to another API (like a public one), but the error I am getting is not related to the API I am using, it must something related to the Creatio business process logic when invoking web services methods, regardless of the endpoint and the API specifications.

Hello,

 

I recommend that you create a support request.

Show all comments

Hello.

How to attach a phone call to a contact and lead using odata3 or odata4?

Also is there a list of collection names?

Like 0

Like

1 comments

Hello,

The name of object collections corresponds to the object's name in Creatio (for Odata  4), and for Odata 3 - the name of the object +Collection (CallCollection).

 

The example requests are available here:

https://documenter.getpostman.com/view/10204500/SztHX5Qb?version=latest

Show all comments

I am trying to find the api list of this crm, I find the postman collection also, but unable to generate the access token

Like 1

Like

3 comments

Have you checked in here ? : Integrations & API | Creatio Academy

 

We are using the CREATIO API to get/update data from or into the CRM.

It works well.

 

Greetings,

 

Please use this documentation:



https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…



Regards,

Orkhan

Orkhan,

Here you have the Creatio API Doc ready to use 

https://documenter.getpostman.com/view/10204500/SztHX5Qb

 

Regards

Show all comments

Hello community,

 

I want to add data inside a section with the OData interface. I've already checked the documentation at https://documenter.getpostman.com/view/10204500/SztHX5Qb?version=latest and https://academy.creatio.com/docs/developer/integrations_and_api/data_se… but I have the following problem:



I am using a simple Python script to make the API requests in these steps:

 

1. Authenticate in the website using the Authentication method

This works nice using the credentials as payload inside the request.

 

2. Extract the cookie returned inside the header response.

From the test I've made, I need to extract the cookie parts UserName, BPMCSRF, .ASPXAUTH, BPMLOADER and append all of them inside a "Cookie" header like this example:

 

"Cookie: BPMLOADER=; UserType=General; UserName=; .ASPXAUTH=; BPMCSRF=;"

 

Everywhere I've checked inside the documentation it says that it is enough using a header called BPMCSRF with that value from the Set-Cookie response header, but in my case it fails using that value and I have to build the Cookie myself with the different values specified above.

 

3. Perform a POST request to a section like https://mycreatio.com/0/odata/Case

Here the request fails and I get an error 403 - Forbidden with the following message:

 

403 - Forbidden: Access is denied.

You do not have permission to view this directory or page using the credentials that you supplied.

 

And I don't understand why Creatio returns that error, because if I try doing a GET request to the same URL it returns the full list without any problem, but performing a POST request using the same cookie structure inside the headers doesn't return the expected inserted register.

 

Thanks in advance in for your help.

 

Regards.

Like 0

Like

3 comments

Just to clarify, in theory the issue is not related to user permissions as I have tried to insert registers with multiple users (one of them being Supervisor) and in multiple sections, but I always get the same error.

 

P.D. I am using OData 4

Hello Alejandro!

 

For correct requests, you need to use all cookies not "only a part". Also "BPMCSRF" must be used in cookies and as a separate parameter in the header as mentioned in the example here Creatio API (getpostman.com).

Please try and test it with the corresponding changes.

Hello Kyrylo,

 

Thank you very much for your help. In my case the problem was only with that "BPMCSRF" header that I was not building properly, for the cookie values that I have to pass inside the "Cookie" header I tried passing ALL the values extracted from the response header "Set-Cookie" but it didn't let me authenticate, so the solution that works for me is creating a cookie manually with only the values  UserName, UserType, BPMCSRF, .ASPXAUTH, BPMLOADER that I mentioned before.

 

The POST requests are working flawlessly now. I will try now to upload files using OData following the documentation and I would highly appreciate if you are able to help me again if I have trouble.

 

Thank you very much.

Show all comments

Hello community,

 

I want to get the attached files information from a given case inside my environment. As the primary section containing the information is case, I know that I can retrieve the case information from 

 

https://mycreatio.com/0/odata/Case

 

And the attached files can be extracted from 

 

https://mycreatio.com/0/odata/CaseFile

 

Where each element from the response has the format:

{
  "Id": "7bb283a4-2f30-7193-37f3-79c8465ceda4",
  "Name": "<value>",
  "CreatedOn": "<value>",
  "CreatedById": "<value>",
  "ModifiedOn": "<value>",
  "ModifiedById": "<value>",
  "ProcessListeners": 0,
  ...
  "Size": <value>,
  "CaseId": "<value>",
  "IsNeedToNotify": true,
  "SysFileStorageId": "<value>",
  "FileGroupId": "<value>",
  "Tag": "<value>"
},

As you may see there is a field "CaseId" which is used to link the file object to the case object.

 

The problem I have is that I want to get the list of files from a case only by the Case Id. I've tried many different approaches using the OData standard syntax like:

 

'">https://mycreatio.com/0/odata/CaseFile?$filter=CaseId eq '<value>'

 

But I always get an error when trying to access the resource. In the previous example, the error I get is related to the field data type. Creatio yells because the CaseId field is of type Guid but in the comparison I am using a string.

 

By the way, changing the query to:

 

'">https://mycreatio.com/0/odata/CaseFile?$filter=CaseId eq guid'<value>'

 

or

 

'">https://mycreatio.com/0/odata/CaseFile?$filter=CaseId eq <value>

 

Doesn't fix the issue.

 

Can you please help me with this query that I am struggling to do?

 

Regards

Like 0

Like

1 comments
Best reply

Rather than using CaseId, use Case/Id:

https://mycreatio.com/0/odata/CaseFile?$filter=Case/Id eq idvalue

Ryan

Rather than using CaseId, use Case/Id:

https://mycreatio.com/0/odata/CaseFile?$filter=Case/Id eq idvalue

Ryan

Show all comments
Hello. 
Hello.

I need to send an image through an API to convert it to base 64, I tried to do it using the Web service tool but it does not allow me to place an image or file field to use it from the bpm, I was looking for some information and I saw that it could be done using a script, I just haven't found a way to do it. Could you help me with some example or idea so I can do this please?

 

 

 

Like 0

Like

1 comments

Hello Laura, 

 

Please refer to this article for more detailed information about such functionality.  

Also, similar questions have already been discussed in the below posts, please review them for the detailed information:

https://community.creatio.com/questions/there-option-send-image-file-re…

https://community.creatio.com/questions/file-type-request-parameter-res…

Please inform us in case of any questions!

Best regards,

Anastasiia

Show all comments

Hi community!

 

I have to integrate with a third-party tool that cannot send a request to the auth service and handle the cookies correctly.

 

Is there another method similar to webhooks using an API key in the URL or in the data itself?

 

Thanks in advance,

Robert

Like 1

Like

1 comments

Greetings, 

 

Possibly only through Oauth. 



Link to documentation: https://academy.creatio.com/docs/user/on_site_deployment/deployment_add…;



Best regards, 

Okrhan

Show all comments