P
P
ph4n70m2015-08-26 20:58:00
PHP
ph4n70m, 2015-08-26 20:58:00

How to organize interaction between REST backends?

Good afternoon. There are several servers with services that implement the REST API. Some requests in their work from one server must exchange data with other backends. Question - what are the best practices?
It is clear that on the client application it sends requests to the right place and aggregates the result in the browser. But what is the best way to do this if the servers need data from each other? Normal curl requests?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
Pavel Volintsev, 2015-08-27
@ph4n70m

It's called SOA : services talking to each other.
Thus, for example, mail is sent - one backend (your server) sends a message to another backend (mail server) using the SMTP protocol.
You can upload files to another server - WebDAV, FTP or CSP protocol.
Your server can post tweets on behalf of another user - this is done via HTTP, with an authorization token. Requests are sent via curl or Guzzle.
In general, curl is the norm.

M
Mikhail Osher, 2015-08-26
@miraage

I don't see anything wrong with using curl.

S
Sergey, 2015-08-26
Protko @Fesor

Regular curl (or better Guzzle) requests inside repository services. Then you will be able to abandon curl in the future and switch to MQ for example or something else ... depends on the task and goals that you are following.

P
ph4n70m, 2015-08-27
@ph4n70m

Thanks for answers! I will dig towards SOA

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question