I
I
Ivan Vovchok2020-08-28 11:23:28
Laravel
Ivan Vovchok, 2020-08-28 11:23:28

How to implement an API for writing data from an external resource?

Hello.
I confess, I’m not sure if the question is correctly posed, but I couldn’t find anything similar on the network (perhaps I was looking in the wrong place).
Essence of a question in the following:
There is an application which works with base, for example, posts. And there is an external resource where you can write these posts.
Is there a way (and how it looks like) to set up receiving requests from this resource, in which posts will be transmitted?
Well, after that, already manage the data and save them in the database.
I apologize for the possible triviality of the question.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton October, 2020-08-28
@Lyrium

Write an API for the posts you need. The apiResource route will do (these are the index, show, store, update, destroy methods)
describe them all separately in a suitable controller. So it will be more convenient in the future that the logic for the API is apart.
And in a third-party application, simply use the received endpoints from the main one.
You need to get all the posts, conditionally GET blog.com/api/posts, update the post PUT blog.com/api/posts/{post_id}, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question