N
N
noname_20192019-05-21 09:50:25
1C-Bitrix
noname_2019, 2019-05-21 09:50:25

1C Bitrix. How to connect data from API and infoblock?

Good afternoon. The essence of the question is this:
There is a list of classes in the gym, which we receive through an ajax request. In the raw version, each element of the lesson looks like this:

{
 "AppointmentID": "nevazhno",
 "Service": {
 "Title": " ",
 "Id": "nevazhno",
 "Color": null,
 "Course": {
 "Title": " ",
 "Id": "nevazhno"
 },
 "Photo": "nevazhno"
 },
 "Group": {
 "Title": " ",
 "Id": "nevazhno"
 },
 "Room": {
 "Title": "nevazhno",
 "Id": "nevazhno"
 },
 "Employee": {
 "FullName": " ",
 "Id": "nevazhno",
 "Position": {
 "Title": " ",
 "Id": "nevazhno"
 }
 },
 "AvailableSlots": 30,
 "StartDate": "2019-03-21 07:00",
 "EndDate": "2019-03-21 20:00",
 "Duration": 780,
 "preEntry": true,
 "ClubID": "nevazhno",
 "Cost": 490,
 "Commercial": true,
 "CheckinTime": {
 "StartDateTime": "2019-03-21T00:00:00",
 "EndDateTime": "2019-03-21T20:00:00"
 },
 "MarketingEvent": false,
 "Photo": "nevazhno"
 },


Each lesson has its own type.
The task is to implement the output of the resulting list of classes through infoblocks. To be honest, I do not fully understand how this can be done. I read about a way to add an element to an infoblock via CIBlock::Add, but I'm not completely sure that it is suitable because of the large number of records received in advance.
Is there a way to make the created infoblock contain elements for specific types of classes (well, let's say, the elements "Running", "Free lesson", etc.) and then, loading the data from the ajax request, using comparison (for example, through code or id), load the necessary data from class types and subsequently display them? Well, for example, to get several activities from a request with the "Running" type, load the necessary data from the infoblock element with the same name, and display it on the site? If this is possible, please tell me how to implement it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Nikolaev, 2019-05-21
@nikolaevevge

First, decide on the structure of the infoblock. Create the required properties. Think whether 1 information block can logically cope with this task.
Perhaps you need to create sections, for example, running will be a section and an info block is already in it.
Here are examples of requesting information from the infoblock via the blog.ivru.net/?id=43 API (it makes sense to look when you decide on the structure).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question