L
L
Lorem Ipsum2020-07-03 10:02:40
1C-Bitrix
Lorem Ipsum, 2020-07-03 10:02:40

How to get links to an image like *.jpg (or *.png) in Bitrix24 REST API?

I get a list of elements with the code:

CRest::call('lists.element.get', array(
       'IBLOCK_TYPE_ID' => 'lists',
       'IBLOCK_ID' => IB_ID,
       'ELEMENT_ID' => ELEMENT_ID,
   )
);

Returns:
[PROPERTY_158] => Array
(
     [237492] => 184049
     [237493] => 184050
     [237494] => 184051
     [237495] => 184052
     [237496] => 184053
     [237497] => 184054
     [237498] => 184055
)

I'm trying to get the URL of the file with the code:
CRest::call('lists.element.get.file.url', array(
   'IBLOCK_TYPE_ID' => 'lists',
   'IBLOCK_ID' => IB_ID,
   'ELEMENT_ID' => ELEMENT_ID,
   'FIELD_ID' => FIELD_ID
));

Returns:
[result] => Array
       (
           [0] => /company/lists/45/file/0/29850/PROPERTY_158/184049/?ncc=y&download=y
           [1] => /company/lists/45/file/0/29850/PROPERTY_158/184050/?ncc=y&download=y
           [2] => /company/lists/45/file/0/29850/PROPERTY_158/184051/?ncc=y&download=y
           [3] => /company/lists/45/file/0/29850/PROPERTY_158/184052/?ncc=y&download=y
           [4] => /company/lists/45/file/0/29850/PROPERTY_158/184053/?ncc=y&download=y
           [5] => /company/lists/45/file/0/29850/PROPERTY_158/184054/?ncc=y&download=y
           [6] => /company/lists/45/file/0/29850/PROPERTY_158/184055/?ncc=y&download=y
       )

Actually, I need to get a bunch of images of the order of 500 MB to insert into XML. I need to immediately receive a link like *.jpg. In one element of the "list" there can be from 3 to 7 images. And downloading them and uploading them somewhere is a waste of time, plus, as I understand it, authorization will be needed for such links, what else will need to be screwed into the code.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question