We are trying to integrate our service with Creatio CRM and one of our needs is adding custom fields to such entities as Lead, Contact, Order after getting an access token to customer's CRM account

 

Is there any possibility to use Creatio Rest API to add such fields? 

If yes, I would be glad to get an example of such request

 

Thank you

Like 0

Like

0 comments
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

I want to build an 'add' client wizard for our customer service to make it easy for them and also to prevent mistakes.

 

The first step would be to insert zipcode and housenumber, then it will make an API call to see how many adresses match these two parameter. 

 

The list that is returned, if the list is > 1 it should show you the information from the array and make you able to choose 1 of the options. 

 

If the list is 1 it should automatically pick the only available option.

 

I understand how to create the business process but combining this with a user interface is still difficult for me, is this even possible? 

Like 1

Like

3 comments

Hi, take a look at this article, I believe that there you can find a piece of useful information. It is written for the Freedom UI page, however, in earlier versions, you can just use XMLHttpRequest for sending the request, wait for a response, and process it.

The link somehow is broken now.

Pascal,

Here you are - link

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

Hello team,

I have exposed an endpoint, but keep recieveing the 404 (Endpoint not found) when i call it from postman.

I have followed: https://academy.creatio.com/docs/developer/getting_started/develop_appl…

Is there any other prior configurations that need to be done in order to recieve a status 200?

Thank you

Sasori

Like 0

Like

3 comments
Best reply

Hello,

 

404 error means that there is no issue with the authorization or with the request type (GET\POST etc), it means that the endpoint you are calling doesn't exist (either because the link is not valid or because there is nothing behind this link). Also please try configuring the service as it's described here.

PS:

I am able to login. I recieve a status 200 when calling 

ServiceModel/AuthService.svc/Login.

I copy the generated BPMCSRF and place it to the Headers of the Custom web-service. But i keep recieving status 404

Hello,

 

404 error means that there is no issue with the authorization or with the request type (GET\POST etc), it means that the endpoint you are calling doesn't exist (either because the link is not valid or because there is nothing behind this link). Also please try configuring the service as it's described here.

Thank you for you advice Oleg. Issue was resolved

Show all comments

Hey all, 

 

Does anyone know how long a cookie auth token is valid for, and is it best practice to call and create another one for each call to the API? 

 

Also, is there anyway to request an Auth Token without having to use an email and password? It doesn't seem so safe to share this information with 3rd party systems (in my case, Make.com). 

 

Thanks!

Like 0

Like

1 comments

Hello,

 

The validity of Cookie Auth depends on the user session.

This information can be found in the "User session timeout" system setting.

Show all comments

Hi, I am working on a product. I made a postman collection for Creatio. Everything works fine inside postman. I am successfully creating leads using the API. Now I am creating a PHP script with the same procedure. After authentication, I am getting the BMPCSRF token in Curl headers. When I try to create a lead, or contact using the updated BMPCSRF token, I am getting "400 bad request" error. I am passing all the required parameters in CURL headers. This is the CURL request.

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://'.  $creatioUrl .'.creatio.com/0/odata/Lead',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>json_encode($data->data),
  CURLOPT_HTTPHEADER => array(
    'ForceUseSession: true',
    'BPMCSRF: '.$arr['BPMCSRF'],
    'Content-Type: application/json',
    'Content-Length: 0'
  ),
));
$response = curl_exec($curl);
curl_close($curl);

Kindly guide me on what I am doing wrong here because nothing is working after the Authentication.

Like 0

Like

4 comments

I assume since this is a POST that this is attempting to add a lead, correct? 

Can you show what the data you're posting looks like? Any Lookup fields would be "LookupNameId" (not just "LookupName"). Also be sure you're including any required fields etc.

Also, maybe try including the Accept header with value "application/json"?

Ryan Farley,

Hi, thanks for the response. Yes, I am using POST to submit a lead. I am sending this data:

{
        "Account": "Awais Khalid",
        "Contact": "Test User",
        "FullJobTitle": "Developer",
        "Email": "testuser1@gmail.com",
        "MobilePhone": "9230068367253",
        "LeadName": "Need for our products / Alexander Wilson, Alpha Business"
    }

I also added the accept header, but getting same error:

400 Bad request - Your browser sent an invalid request.

Here is my PHP code: 

 

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://'.  $creatioUrl .'.creatio.com/0/odata/Lead',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode($data->data),
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Accept: application/json',
    'Content-Length: 0',
    'ForceUseSession: true',
    'BPMCSRF: '.$arr['BPMCSRF']
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

I am running this script through postman. This is the payload:

 

I am successfully getting the BPMCSRF token after authentication. But Leads API is not working. I will appreciate your response. Thanks

Awais,

There must be something else wrong with the code. I took your exact same payload and posted it and I can create a lead. I'm just doing it though Postman. 

Headers: 

Body:

Result:

 

I usually bring over the cookies from the auth request as well, not just the BPMCSRF header.

 

Ryan

Hi @Awais, did you ever figure out what was wrong with this code?  We are having a similar issue.

Show all comments

Can Creatio send data to API?

like two-way integration?

get data from API and store it in Creatio then send the data to another API?

 

thanks.

Like 0

Like

1 comments

Hello,



You can do that by adding the desired web services in the "Web services" section in the system settings. Then you can create a business process that will call those API, receive the information from them, store it in the system creating new records (You can create a new object and store the information inside, which will be basically storing information inside an SQL table) ,  or just keep it as parameters inside the same business process, and then send it again to another web service. 



I would suggest you reading our academy instructions regarding business processes and web services to understand how you can combine them:

https://academy.creatio.com/docs/8-0/user/bpm_tools/business_process_se…

https://academy.creatio.com/docs/user/customization_tools/web_services/…

Here is an example of implementation:

https://community.creatio.com/questions/call-creatio-web-service-inside…

 

Best regards,

Dariy

Show all comments

Good day community,

 

I'm having trouble with adding the correct JSON path for my request body.

 

I have to send a POST request with the following JSON below:

{
  "members": [
    {
      "@odata.type": "--TYPE HERE--",
      "user@odata.bind": "--USER 1 HERE--"
    },
    {
      "@odata.type": "--TYPE HERE--",
      "user@odata.bind": "--USER 2 HERE--"
    }
  ]
}

This is how my parameter structure looks:

Generated JSON here:

{
	"chatType": "oneOnOne",
	"members": [
		{
			"@odata": {
				"type": "--TYPE HERE--"
			},
			"user@odata": {
				"bind": "--USER 1 HERE--"
			}
		}
	]
}

The problem with this structure is that it generates a nested key for type under @odata, and for bind as well. I don't wan't this to happen if possible.

 

Is there any way to get this to work using parameters in web service? Or would my only resort be to generate the request body via script?

Like 0

Like

2 comments

Hello,

 

The body of the webservice seems to be generated properly since "members" is the array of objects "@odata" and "user@odata". The request was properly parsed and that's why you saw the result as on the screenshot. If this structure won't work in your business case then a separate script task should be created to sent the request.

 

Best regards,

Oscar 

Hi Oscar,

 

Thank you for you response.

 

In forming the json path, I would have made it as $.[members]["@odata.dataType"] or $.[members]["user@odata.bind"], but I'm guessing that this is not possible using the built-in function (nesting parameters) in Creatio?

 

I think I'll instead be resorting to creating a script task for this.

 

Thank you!

 

Lyle

Show all comments

Hello

I am making a small python application that can upload and attach files to creatio.

Connection and authentication to creatio is ok.

I can use /0/odata to get value from creatio (in the sam script with the same session).

 

I get a 403 when using  /0/rest/FileApiService/UploadFile.

Here is my request uri that I send via a Post

https://CreatioURL/0/rest/FileApiService/UploadFile?fileapi165097538874…

 

My request with headers:

POST /0/rest/FileApiService/UploadFile?fileapi165097538874218&totalFileLength=106789&fileId=a00a2990-87d3-4cc8-a96a-465243dfc6ba&mimeType=application%2Fpdf&columnName=Data&fileName=INV-10699-SAF.pdf&parentColumnName=Invoice&parentColumnValue=ff4a0279-1e86-4983-918b-fefd28483df3&entitySchemaName=InvoiceFile HTTP/1.1\r\nHost: creatiosite.com\r\nUser-Agent: python-requests/2.27.1\r\nAccept-Encoding: gzip, deflate, br\r\nAccept: application/json\r\nConnection: keep-alive\r\nForceUseSession: true\r\nContent-Type: application/pdf\r\nCookie: .ASPXAUTH=; BPMCSRF=zaZ0DPSfWLLw8otH5Vzwu.; BPMLOADER=klb0towmoqgvkw0pn4n5hzdy; UserName=97|110|116|111|105|110|101|46|103|105|108|108|105|101|114|111|110\r\nContent-Length: 106789\r\n\r\n'

 

 

 

Like 0

Like

8 comments
Best reply

Hello Antoine,

It's not enough to include the cookies from the original request. You have to also read the value of the BPMCSRF cookie and add to header as well as "BPMCSRF" (it's looking for this specific header, not a cookie with this value). Does that make sense?

Basically, after the authentication request, copy the value of the BPMCSRF cookie and add a BPMCSRF header with that cookie value.

Ryan

Hello,

 

Mostly seems that there is no separate BPMSCRF header in the request you are sending (it's the most common issue for 403 error in Postman). Try adding it as below:

Best regards,

Oscar

Hello

Thank you for your answer, I m sending the request via a "session" object in python. Creating the object session when authenticating so it keeps all cookies. You can see in my request header that the BPMCSRF parameter is present in the header cookie. Making a "get" request to odata with the same session works. Meaning the BPMSCRF value is correctly received by Creatio.

I suspect a bad particular header or request parameter!

For example, what is the purpose of the first request parameter:fileapi165097538874218 ?

I got this one by capturing a request with fiddler.

Thank you

Hello Antoine,

It's not enough to include the cookies from the original request. You have to also read the value of the BPMCSRF cookie and add to header as well as "BPMCSRF" (it's looking for this specific header, not a cookie with this value). Does that make sense?

Basically, after the authentication request, copy the value of the BPMCSRF cookie and add a BPMCSRF header with that cookie value.

Ryan

Ryan Farley,

Hello

Thank you for your answer

Now I get reply: 'HTTP/1.1 200 OK\r\n' response.

But my file is not beeing created in Creatio. 

Do you know if I have to create the object prior to uploading the file content with the file api (/0/rest/FileApiService/UploadFile)?

Thank you 

 

Antoine Gilliéron,

Looks like you'te validating fine now, but the request is missing something.

When I do it, I include the following (looks like you have these accounted for, but just listing for something to check):

 

Headers:

  1. Content-Disposition = attachment; filename=TheFile.docx
  2. Content-Length = size in bytes
  3. Content-Range = bytes 0-{size in bytes - 1}/{size in bytes}

Query String Parameters:

  1. totalFileLength = size in bytes
  2. fileId = new guid id value
  3. columnName = "Data"
  4. fileName = "TheFile.docx"
  5. parentColumnName = "Invoice"
  6. parentColumnValue = the invoice Id
  7. entitySchemaName = "InvocieFile"

Request Body:

  1. "application/octet-stream" = the file bytes

Ryan

Antoine Gilliéron,

Also, to confirm:

Do you know if I have to create the object prior to uploading the file content with the file api 

No, there's no need to create the record separately first.

Hello Ryan

I was missing some of the headers and the correct Content-Type.

Now everything works as expected.

Thank you so much for your help.

I am trying to make the same request, but it returns 200 but with a json saying it gave an error.

{
    "errorInfo": {
        "errorCode": "FileNotFoundByLocatorException",
        "message": "File not found by locator 'Terrasoft.File.EntityFileLocatorEntitySchemaName=ActivityFile, RecordId=2b796759-8846-41b9-9c2b-cfd428493b3c'",
        "stackTrace": "   at Terrasoft.File.File`2.get_FileMetadata()\r\n   at Terrasoft.File.File`2.InitContentStorageId()\r\n   at Terrasoft.File.File`2.<WriteAsync>d__45.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Terrasoft.Common.Threading.AsyncPump.Run(Func`1 asyncMethod)\r\n   at Terrasoft.Configuration.FileUpload.FileUploader.Upload(IFileUploadConfig fileUploadConfig)\r\n   at Terrasoft.Configuration.FileUpload.FileUploader.UploadFile(IFileUploadConfig fileUploadInfoConfig)\r\n   at Terrasoft.Configuration.FileUpload.FileUploader.UploadFile(IFileUploadInfo fileUploadInfo, Boolean isSetCustomColumns)\r\n   at Terrasoft.Configuration.FileApiService.UploadFile(Stream fileContent)"
    },
    "success": false,
    "nextPrcElReady": false,
    "queryId": null,
    "responseStatus": {
        "ErrorCode": "FileNotFoundByLocatorException",
        "Message": "File not found by locator 'Terrasoft.File.EntityFileLocatorEntitySchemaName=ActivityFile, RecordId=2b796759-8846-41b9-9c2b-cfd428493b3c'",
        "StackTrace": "   at Terrasoft.File.File`2.get_FileMetadata()\r\n   at Terrasoft.File.File`2.InitContentStorageId()\r\n   at Terrasoft.File.File`2.<WriteAsync>d__45.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Terrasoft.Common.Threading.AsyncPump.Run(Func`1 asyncMethod)\r\n   at Terrasoft.Configuration.FileUpload.FileUploader.Upload(IFileUploadConfig fileUploadConfig)\r\n   at Terrasoft.Configuration.FileUpload.FileUploader.UploadFile(IFileUploadConfig fileUploadInfoConfig)\r\n   at Terrasoft.Configuration.FileUpload.FileUploader.UploadFile(IFileUploadInfo fileUploadInfo, Boolean isSetCustomColumns)\r\n   at Terrasoft.Configuration.FileApiService.UploadFile(Stream fileContent)",
        "Errors": null,
        "Meta": null
    },
    "rowsAffected": -1
}

I have added all the header and parameters correctly and also the file in the body.

 

Show all comments