Hacker News new | ask | show | jobs
by pledess 790 days ago
For example, GET /tickets/12/messages/5 has these advantages over api_get_message_from_ticket?ticket_id=12&message_id=5

Avoids writing everything twice: you don't need to name the data fields both in the base URL and in the query string

If there are several parameters, writing everything twice may make the URL longer than one physical line in a text editor

The ? and & characters need to be quoted in most shells

The _ characters are sometimes hard to read if the entire URL is underlined

Names with api_json don't make it clear whether the request body must be sent as JSON, the response will be JSON, or both