Rest API in PHP - how to work with terminated routes in .json?

0

I'm creating a Restful web service in PHP. I'm not using any framework.

I am following the recommendations of standards or best practices for developing web APIs, suggested by the White House .

On their website, in the first line, we find the following recommendation of a URL to retrieve a resource:

List of magazines:
GET http://www.example.gov/api/v1/magazines.json 

So I did not understand how this URL ending in ".json" will work, since all project pages should end in ".php" correct?

The closest I could get was

http://www.example.gov/api/v1/magazines.json.php

But the ".php" ending must be included in the URL or code that will consume the service.

So here's my question: How to make a URL ending in .json be recognized by the URL or API code to point to the right place that will handle the request and return a JSON?

    
asked by anonymous 27.10.2016 / 16:11

0 answers