M
M
Michael2016-08-26 17:47:46
Yii
Michael, 2016-08-26 17:47:46

How to name resources in API?

The application has an api application, it has a module v1. At the moment, the API is accessed like this: /api/v1/customer/
But what if you need to combine 2 api: my application and the application that my server works with (via api)?
/api/v1/customer/get-uniq-results
/api/v1/anotherservice-customer/get-uniq-results
/api/v1/my-service-anotherservice-customer/get-uniq-results (mix results).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Ernest Faizullin, 2016-08-26
@springimport

I would leave /api/v1/customer/get-uniq-results
You can specify through which service to receive the result like this /api/v1/customer/get-uniq-results?service=my-service
and/or wait for the service parameter via POST,
and inside the customer method, depending on the service parameter, call my-service or anotherservice

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question