File type Request Parameter in REST API

Hi Community,

I am trying to make a request from Creatio to the HTTP REST API Endpoints. |Where File should be added to the API request. 

Is there any way to work with the File type request Parameter in Rest API from Creatio? If yes, please suggest to me how I can achieve this.

 

An example of an API call from Postman is something like as per below :

 

Like 0

Like

3 comments

Hi Patrik,

 

To successfully upload an image you need to make sure that "WebDav publishing" feature is disabled in Windows features of the IIS server (can be found at "World wide web services" -> "Common HTTP Features" -> "WebDAVPublishing"):

Once done you need to perform the following steps:

 

1) Create a POST request to https://app_root_URL/0/odata/SysImage with the JSON raw body with the following content:

{
    "Name": "scr_NewContactPhoto.png",
    "Id": "330006E1-CA4E-4502-A9EC-E54D922D2C01",
    "MimeType": "image/png"
}

330006E1-CA4E-4502-A9EC-E54D922D2C01 should be a random unique identifier. This request will create a record in the SysImage table and the response should be similar to the below:

{
    "@odata.context": "https://app_root_URL/0/odata/$metadata#SysImage/$entity",
    "Id": "330006e1-ca4e-4502-a9ec-e54d922d2c01",
    "CreatedOn": "2021-09-30T10:24:26.830457Z",
    "CreatedById": "410006e1-ca4e-4502-a9ec-e54d922d2c00",
    "ModifiedOn": "2021-09-30T10:24:26.830457Z",
    "ModifiedById": "410006e1-ca4e-4502-a9ec-e54d922d2c00",
    "ProcessListeners": 0,
    "UploadedOn": "0001-01-01T00:00:00Z",
    "Name": "scr_NewContactPhoto.png",
    "Data@odata.mediaEditLink": "SysImage(330006e1-ca4e-4502-a9ec-e54d922d2c01)/Data",
    "Data@odata.mediaReadLink": "SysImage(330006e1-ca4e-4502-a9ec-e54d922d2c01)/Data",
    "Data@odata.mediaContentType": "application/octet-stream",
    "MimeType": "image/png",
    "HasRef": false,
    "PreviewData@odata.mediaEditLink": "SysImage(330006e1-ca4e-4502-a9ec-e54d922d2c01)/PreviewData",
    "PreviewData@odata.mediaReadLink": "SysImage(330006e1-ca4e-4502-a9ec-e54d922d2c01)/PreviewData",
    "PreviewData@odata.mediaContentType": "application/octet-stream"
}

2) Create a PUT request to https://app_root_URL/0/odata/SysImage(330006e1-ca4e-4502-a9ec-e54d922d2c01)/Data with the binary body and select an image there:

Once executed the response will be 200OK.

 

And after that we can perform a GET request to check the result:

Please also note that BPMCSRF cookie should be always in headers:

Best regards,

Oscar

Hi Oscar,

Thanks for the Guidance, But I want to make an API call from Creatio itself ( Using Web-Service / Script Task ), not from Postman

 

Could you guide me on that? 

Hi Pratik,

 

Please see examples here https://academy.creatio.com/docs/developer/integrations_and_api/data_se…

 

Best regards,

Oscar

Show all comments