Skip to content

Instantly share code, notes, and snippets.

@bdunogier
Last active January 4, 2016 19:09
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bdunogier/8665017 to your computer and use it in GitHub Desktop.
EZP-22217: REST Country list specifications

REST Countries list specifications

JIRA story: http://jira.ez.no/browse/EZP-22217

Implement a REST service that gives access to an ISO-3166 formatted list of world countries.

Use-cases

  • presenting a country options list from any application that uses the REST API

Get the list of countries

Resource: /api/ezp/v2/services/countries Method: GET Content-Type: application/vnd.ez.api.CountriesList+xml

Example

GET /api/ezp/v2/services/countries
Host: example.com
Accept: application/vnd.ez.api.CountriesList+xml
HTTP/1.1 200
Content-Type: application/vnd.ez.api.CountriesList+xml
<CountriesList>
  <Country id="AF">
    <name>Afghanistan</name
    <alpha2>AF</alpha2>
    <alpha3>AFG</alpha3>
    <idc>93</idc>
  </Country>
  <Country id="AX">
    <name>Åland</name
    <alpha2>AX</alpha2>
    <alpha3>ALA</alpha3>
    <idc>358</idc>
  </Country>
  ...
</CountriesList>

Caching

TTL cache would be sufficient here, as this resource's output isn't meant to change.

Permissions

Would have said none, but there is a risk that this resource is used by anybody to get a free list of countries, as a web service, using bandwidth and processing power

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment