API Documentation
Toggle TOC panel
<access-service>/api/v1/i18n/bundles/{localeCode}

URL structure

1 https://access-service.xy-company.com/api/v1/i18n/bundles/{localeCode}

where {localeCode} is a supported locale code.

Supported methods and overview

  • GET - retrieves the contents of an internationalization (i18n) bundle (specified by localeCode) as key/value pairs in JSON format.
  • POST - uploads a custom i18n locale bundle (for localeCode) to the Cocoon Data Platform's Access Service.

Note: The GET method takes no parameters.

Detailed description

This API endpoint serves a number of purposes:

  • Retrieves the contents of the bundle (specified by {localCode}) as key/value pairs in JSON format.
  • Uploads a custom i18n locale bundle (for localeCode) to the Cocoon Data Platform's Access Service.

Supported roles and conditions

This API endpoint supports requests utilizing Cocoon Data user accounts with the following roles (as described in the SafeShare Administrator's and Organisation Administrator's Guides):

The Cocoon Data Platform's resources available to a Cocoon Data user meeting the criteria above is determined by the access token submitted in the header of requests to this endpoint.

Required headers

The appropriate access token as the Bearer token:

  • Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0NjcwMTY2NjYsInVzZXJfbmFtZSI6ImFsZXgub...

The following header is also required in a POST request to allow multi-part (including binary) form data elements to be uploaded through the request:

  • Content-Type: multipart/form-data

Note: It is also worth appending to this header a boundary parameter, whose string value is used to demarcate each multi-part form data element of the request (i.e. this string is not used for any other purpose throughout the entire request).
For example, to use the following string to demarcate each multi-part form data element:
-----------------------------12345678901234567890123456
assign this string value to the boundary parameter, which in turn is appended to the Content-Type: multipart/form-data header, such that this header will be:
Content-Type: multipart/form-data; boundary=-----------------------------12345678901234567890123456

Required parameters on POST

The following required parameter must be sent in the body of the POST request, as an individual multi-part form data elements:

  • file - The actual data of the custom i18n bundle (in JSON format) to be uploaded to the the Cocoon Data Platform's Access Service.
    Example:
    -----------------------------12345678901234567890123456
    Content-Disposition: form-data; name="file"; filename="da.json"
    Content-Type: application/json
    {YOUR ACTUAL CUSTOM I18N BUNDLE IN JSON FORMAT HERE}
    -----------------------------12345678901234567890123456

Returns from a GET request

If the request succeeded, then an HTTP response status 200 OK is returned.

For successful requests only, a JSON-formatted response containing the following members is also returned:

  • i18nCode - .
  • bundle - A list of key/value pairs consisting of a series of i18n keys and their respective content values.
    Example:
    {
    "i18nCode": "en_us",
    "bundle": {
    "webapp.htmltemplate.myAccount.upgradeaccount.accountboxdescription": "Upgrade your account, set your password below",
    "server.constraints.datetime.valid": "Date is not in the correct format",
    "admin.clientApps.edit.registeredRedirectURI": "Registered redirect URI(s)",
    ...
    }
    }

Returns from a POST request

If the request succeeded, then an HTTP response status 200 OK is returned.

For successful requests only, a JSON-formatted response containing the following members is also returned:

  • bundleErrors - .
    • deltas - .
    • whitelisterrors - .
  • success - .
  • errors - .
    Example:
    {
    "bundleErrors": {
    "deltas": null,
    "whitelisterrors": [
    ]
    },
    "success": true,
    "errors": [
    ]
    }