Get Web App Country Codes

Get the list of the countries where the current webapp is allowed.

Note: This operation does not support: pagination, filtering, or sorting parameters.

Request

  • Method: GET
  • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
    • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
  • Path: /api/v2/admin/sites/current/webapps/{webappname}/countries
    • Alternatively, use siteID instead of 'current'
  • Authorization header: This should contain the authorization token. Here is how to obtain the token.
  • Required Permissions: View Web Apps

Response

Returns an array of strings. Each string contains two letters that correspond to the name of the country.

Examples

Accepts and returns JSON as Content-Type.


Request:

GET /api/v2/admin/sites/current/webapps/WEBAPP_NAME_HERE/countries HTTPS/1.1
Authorization: 14f87f21c5ea4830a06a6314a8aad82b45bc61dc08f24a0fb55599cea83ca811
Connection: keep-alive
Content-Type: application/json

Response:

{
    "links": [{
        "rel": "self",
        "uri": "https://api-ava.worldsecuresystems.com/api/v2/admin/sites/246884/webapps/test app2/countries?skip=0&limit=10"
    }, {
        "rel": "countries",
        "uri": "https://api-ava.worldsecuresystems.com/api/v2/admin/system/countries"
    }],
    "items": ["AI", "AQ", "AG", "US"],
    "totalItemsCount": 4,
    "skip": 0,
    "limit": 10
}

Sample code

var request = $.ajax({
    url: "/api/v2/admin/sites/current/webapps/test app2/countries",
    type: "GET",
    contentType: "application/json",headers: {
        "Authorization": $.cookie('access_token')
    }
});
request.done(function (msg) {
    console.log(msg);
})
request.fail(function (jqXHR) {
    console.log("Request failed.");
    console.log("Error code: " + jqXHR.status);
    console.log("Error text: " + jqXHR.statusText);
    console.log("Response text: " + jqXHR.responseText);
})


Error codes

This method will return the following error codes:

  • 200 - success
  • 401 - unauthorized - when the Authorization header is not present, or contains an invalid site token
    • 10100 - (not authenticated) sub-error code
  • 403 - forbidden : this is returned when the user trying to access the API does not have the web app view permission
  • 404 - not found
    • 190001 - The web app could not be found (the webAppName param from the URL does not match)