M
M
Michael2017-10-12 20:02:13
PHP
Michael, 2017-10-12 20:02:13

How to correctly connect data when working with API?

There are 2 applications: main and auxiliary. The second receives data from the first through the API. In some cases directly, in some of the JS.
API <=> Application <=> JS .
It was necessary to combine orders with other data and display them in a table. Options:

  • make several requests from JS and connect on the client (minus: if you also need to get it in Application, then you need to duplicate the logic;
  • make a general request from JS to Application of the form get-orders-with-xxx (minus: each script has its own request);
  • Graph API, but it's too future.

How to do it better?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2017-10-13
@springimport

Better in the API is the only method
- if it does not slow down, then /api/get-orders-with-invoices
- if it slows down, then /api/get-orders with the optional parameter 'isWithInvoices'
Sorting is also a separate parameter 'sortField'.
In order not to produce another asc / desc parameter, you can sortField=name in ascending order and sortField=-name in descending order.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question