Hello Community,

Besides the built-in functionality for data import, I have seen in community posts the possibility to import data to Creatio from ODATA protocol.

Are there any examples regarding this feature, academy article, or what to know before implementing it?

Best regards,

Sasori

Like 1

Like

1 comments

Hello Sasori,

 

Regarding the general function of OData, you can find detailed information in the following resource:

OData Overview

 

For more specific examples and methods, you can refer to this documentation:

OData Methods and Examples

Show all comments

Hello team,

 

I have written a script using SEQUENCE & TRIGGERS for PostGres to auto increment the record number. This was a decision taken to avoid writing multiple codes through JS and Server side because we get inputs from a lot of sources - 3rd party integration, manual entry & business process.

 

While our trigger works well, we noticed that using odata, the response returned does not have the auto numbered value, whereas the auto numbering is indeed getting stored in the data base.

 

The question is, does Odata response for POST requests get triggered after all DB triggers are completed or does it happen just before a record is inserted into the DB?



PS: I tried triggers using BEFORE update and it did not work

Like 0

Like

1 comments

Hello,

This question needs to be analyzed mo deeply, but, based on your information, the POST request isn't affected by all the DB triggers and therefore happens before the insert.

Also, a small note, if you have autonumbering both on the JS and Server side than a new number will be generated no matter what is the source of the object (data, business process, etc).

Show all comments

Hi everyone 

 

Someone can tell me, How many requests? I could send it into a request batch using Odata v4 (0/odata/$batch)

 

Regards

Like 0

Like

1 comments
Best reply

Hello Carlos, 



The OData protocol has the following limitations:

- The response body can contain up to 20 000 lines.

- A batch request can contain up to 100 sub-requests.

More detailed information can be found in corresponding (and connected to it) article on our Academy. 

 

Best regards,

Anastasiia

Hello Carlos, 



The OData protocol has the following limitations:

- The response body can contain up to 20 000 lines.

- A batch request can contain up to 100 sub-requests.

More detailed information can be found in corresponding (and connected to it) article on our Academy. 

 

Best regards,

Anastasiia

Show all comments

Hi,

We need to integrate 3rd party web application with Creatio DataBase using OData4.

Our question is:

How many concurrent connections with the same Creatio user does Creatio system support?

 

Is it OK to set "ApiUser" Creatio user, and use this user to interact with Creatio with LOTS of concurrent  API requests to  Creatio?

 

Thanks,

Eran.

 

Like 0

Like

1 comments

Good day,

 

Sadly, we do not have exact specifications and limits on the number of connections to Creatio.

You should only be limited by the specs of your Redis server that will have to process those connections.

 

We would additionally recommend you use a header of ForceUseSession: true.

Using a system user through whom you will pass the API request should also work fine.

 

Thank you.

Show all comments

Hi Team,

We want to retrieve a specific record by Id along with all the related elements (eg - Retrieve Account A with all of its related Contacts). 

What we already know:

We can retrieve the account record itself along with related records that are linked with lookupfields, like the PrimaryContact

 

Account(0001111-1111-1111-1111-111111231123)?$expand=PrimaryContact($select=Name)

This works, but it returns only one contact, the primary one.

 

Instead, we need an embedded list of contacts, like

{
    "@odata.context": myurl.creatio.com/0/odata/$metadata#Account(PrimaryContact(Name))/$entity,
    "Id": "22222-222222-2222-222222-22222207ba6",
    "Name": "somename",
    "OwnerId": "111111-11111-11111-11111-1111111",
    "CreatedOn": "2022-11-16T21:11:57.214167Z",
    "Contacts“ : [
{object}, {object}
]
}

Given the first URL in the response, we expected that all NavigationProperties would behave the same:

But this collection:

Is not accessible. If we call for :

Account(0002204c-d255-46c0-bea6-0f32e2e07ba6)?$expand=ContactCollectionByAccount

 

We get this error in return:

{
    "error": {
        "code": "",
        "message": "An error has occurred."
    }
}

If we use other expand values, we retrieve meaningful errors like „Could not find a property named xy“, but this error is not self explaining. How can we return an object with an embedded list of children? I know that in this example we also could ask for a list of Contacts filtered by their account, but we cannot do that in all scenarios we have in mind.

Thank you

Petrika

Like 3

Like

1 comments

Hello Petrika,

 

This property cannot be used to retrieve all contacts related to the account and can be used in filtration only. To retrieve related contacts you need to perform the GET query to the Contact object with the correspondent AccountId filter. Using this approach you will be able to get contacts needed.

Show all comments

We have an implementation of saving data in the "History" of Contacts, and we use the HttpWebRequest method like this POST. However, now every time we try to upload a file into the History email it returns this  Error: 'The remote server returned an error: (400) Incorrect Request.'.

private static bool TransferFile(Guid fileRecordId, string columnName, byte[] file) {
            log.Debug("[START] Transfer file");
            try {
                string requestUri = ServerUriUsr + "ActivityFileCollection(guid'" + fileRecordId.ToString() + "')/" + columnName;
                HttpWebRequest request = RequestHelper.BuildRequest(requestUri, HttpMethod.Put);
                request.Accept = "application/octet-stream,application/json;odata=verbose";
                request.ContentType = "multipart/form-data;boundary=+++++";
                // Recording the xml message to the request stream.
                using (Stream requestStream = request.GetRequestStream())
                {
                    requestStream.Write(file, 0, file.Length);
                }
                // Receiving a response from the service regarding the operation implementation result.
                using (WebResponse response = request.GetResponse())
                {
                    if (((HttpWebResponse)response).StatusCode == HttpStatusCode.Created)
                    {
                        // Processing the operation implementation result.
                        response.Close();
                        log.Debug("[END] Transfer file (Successful)");
                        return true;
                    }
                }
            }
            catch (WebException ex) {
                if (ex.Response is null)
                    log.Error($"TransferFile function error: {ex.Message}");
                else
                    log.Error($"TransferFile function error: {new StreamReader(ex.Response.GetResponseStream()).ReadToEnd()}");
                throw;
            }
            catch (Exception ex) {
                log.Error($"TransferFile function error: {ex.Message}");
                throw;
            }
 
            return false;
        }

The problem only occurs when I try to upload a .docx or .xlsx file

Like 0

Like

2 comments

Have you checked failed IIS requests logs and the applicaiton logs for more information on the invalid request? What was the result of the check?

Oleg Drobina,

I ended up doing more tests and the problem only occurs when it is a .docx and .xlsx type file.

When it is PDF or images it works normally without any problems.

Show all comments

I have tried to retieve the Object in OData. but it shows internal exception with following message. I have already deleted the column Name PhoneNumber.

 

The EDM instance of type '[Terrasoft.Configuration.OData.ContactInformation Nullable=True]' is missing the property 'PhoneNumber'.",

Like 0

Like

1 comments

Hello Prabin, 



Please try to generate source code and compile the website to actualize OData on it. 

After that, please try to run the same request again and check if the response is changed. 



Thank you. 

Show all comments

Dear community,

 

In one of our projects, we encounter an issue with an Odata4-call on the Account section, where following error is returned: 

{"error":{"code":"","message":"An error has occurred."}}

 

So this error occurs with following call in Odata4:

https://dev-convenient.creatio.com/0/odata/Account

 

However, when calling the Account section via Odata3, there is no issue:

https://dev-convenient.creatio.com/0/ServiceModel/EntityDataService.svc…

 

Note that an Odata4 call to other sections or objects also does not returns an error, so the issue seems to be related to the Accounts section in Odata4 only.

 

 

Any idea what might cause this issue? Could this be a data issue?

I have recompiled the complete project, but that did not solve the issue.

 

 

Kind regards,

Vincent

Like 0

Like

5 comments

Hello Vincent,

Please try to use "top" to decrease the number of data.

https://dev-convenient.creatio.com/0/odata/Account?$top=5

Waiting for your feedback.

Best regards, Alex.

Aleksei Efimenko,

Hello Aleksei,

 

Thank you for the feedback!

Unfortunately, I get the same error with the top 5.

 

I also tested with a filter on the Name of the Account.

When I search for an account name that does not exist, I get a (empty) response:

https://dev-convenient.creatio.com/0/odata/Account?$filter=Name%20eq%20…

--> 

{"@odata.context":"https://dev-convenient.creatio.com/0/odata/$metadata#Account","value":[]}

 

When I filter for an existing name, then I also get the error:

https://dev-convenient.creatio.com/0/odata/Account?$filter=Name%20eq%20…

--> 

{"error":{"code":"","message":"An error has occurred."}}

 

Kind regards,

Vincent

Vincent Tahon,

Hello, are there any errors in the browser console?

Is it possible to try postman for this query, maybe it will give the more described error.

Best regards, Alex.

Aleksei Efimenko,

 

I have tried each field seperately, for example:

https://dev-convenient.creatio.com/0/odata/Account?$select=Phone&$filte… eq 06273fab-9dee-40fa-9313-7f85ac69ab68

 

For 4 fields, I got an error:

1. Description 

- Error: The query specified in the URI is not valid. Could not find a property named 'Description' on type 'Terrasoft.Configuration.OData.Account'.

--> In the object, I cannot find this field, but it looks like a system field?

2. UsrMZAabonnementId 

- Error: The query specified in the URI is not valid. Could not find a property named 'UsrMZAabonnementId' on type 'Terrasoft.Configuration.OData.Account'.

--> In the object, I cannot find this field. Probably deleted by the user?

--> Have now added the field UsrMZAabonnementId, so this error is solved.

3. UsrkenmerkGGZ_ZPM 

- Error: An error has occurred.

--> This field exists. Are underscore characters not allowed?

4. Logo 

- Error: An error has occurred.

--> This is a system field and should not be an issue?

 

For the general query, the error is also 'An error has occurred.'

https://dev-convenient.creatio.com/0/odata/Account?$filter=id%20eq%2006…

 

So I assume error 3 and/or 4 are causing this error?

Vincent Tahon,

Yes, the underscore is the big problem for OData 4, please try to rename a column, compile the application and try again.

Best regards, Alex.

 

Show all comments

Hello community,

I'm working on an assembly package and I'm currently using OData3 for some integrations. I noticed that the end-point "/0/ServiceModel/EntityDataService.svc/" is not exposing the methods of the custom entities. Do you have any ideas to solve this problem?

Let me know.

 

Thanks in advance,

Luca

Like 0

Like

3 comments

Hello Luca,

 

I am not sure I understand you correctly. Can you please send an expected result and an actual result you receive?

 

Thank you!

 

Best regards,

Oscar

Hi Oscar Dylan,

I have a visual studio C# project binded to OdataV3 endpoint ("/0/ServiceModel/EntityDataService.svc/") and I don't find the custom entities created by me.

 

Using the following URL: "http://localhost/0/odata/$metadata" (ODataV4) I can see the expected entities.

 

The problem is that if I try to generate ODataV4 client code using "Unchase OData Connected Service" add-On it returns this error when I use ODataV4 endpoint.

 

While if I use ODataV3 endpoint with "Unchase OData Connected Service" add-On everything runs fine but the custom entities are missing (first picture). Furthermore if I use ODataV3 in a simple package every custom entity endpoint is available.

 

Did I make myself clear?

Thanks,

Luca

Luca Tavasanis,

 

Yes, it's clear now, thank you!

 

The problem is that OData3 forms its metadata based on the default assembly and doesn't include separate assemblies (where your objects are located), while OData4 uses a separate special assembly (neither default nor the custom one). And that's why its impossible to get access objects in packages compiled in the separate assembly using OData 3.

 

Our core R&D team will review this logic in the future releases, meanwhile the only way to access the object is using OData 4 only.

 

Best regards,

Oscar

Show all comments

Hello everybody

When we request section data via OData the date fields are returned with the authenticated user time-zone setting and not UTC.

Is there a way to obtain date fields in UTC via OData, regardless authenticated user time-zone?

Thanks

Like 0

Like

1 comments

Hello,

 

The only way to achieve your business task is to create a separate user that will be used in OData requests authentication, set the timezone for this user as UTC, make this user a system administrator and execute OData requests under this user.

 

Best regards,

Oscar

Show all comments