T
T
teodolit2019-05-29 11:28:54
PHP
teodolit, 2019-05-29 11:28:54

Are there any examples, api libraries in php for getting data from sites?

Good afternoon. The task arose to write an api for bitirx, so that partner sites could receive orders and its properties, when creating it on a site on Bitrix and vice versa, when creating an order on their side, they could transfer it to us and we could enter it into our system. And I don’t understand how exactly to transfer data between sites? There is an idea to create an api.php page, where partners in a GET request will transfer data like id_zakaza=1&summ=1.. , but I feel there are more correct ways.
And it’s completely incomprehensible how to transfer our orders to their systems.
I have not encountered such a task before and I do not understand where to dig.
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Shumov, 2019-05-29
@teodolit

Curl
Guzzle around curl
There is always a socket, but do you need it?)
And to get data from your resource, make a normal rest API and don't forget about security

R
Roman Gritsuk, 2019-05-29
@winer

REST has recently appeared in Bitrix. For the most part, he works with B24.
In the update of the sale 18.6.0 module, I saw the appearance of a method for working with module entities (orders, baskets, etc.).
There is no documentation for REST for BUS. To work with it, you need to read the source code.
Authorization on REST happens in different ways. One of them is webhooks.
To create a webhook in BUS, you need to use the bitrix:rest.hook.ap.edit component. Connect on any page. (it should not forget to set the EDIT_URL_TPL parameter).
After the webkuh is created, it will be possible to access the API through regular http requests.
For example, you can get an order like this:
TOTAL:
You can use what is now.
If you need something that is not there now, you can add your own methods
. If you don’t want to mess with it, you can write your REST from scratch or using some kind of blanks. I saw somewhere the module blank artamonov.api. Now I couldn't find anything.
But one way or another, I have not seen a completely ready-made solution for your task.

A
Alex-1917, 2019-05-29
@alex-1917

The text of the question fully describes the standard Bitrix import-export functionality. Learn this component and you will succeed. You don't have to write anything. Almost...)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question