Locales

Authentication: JWT | API Key

Locales enable multilingual content management in FoxNose. Each environment can have multiple locales with one designated as the default. For a comprehensive guide on localization concepts and best practices, see the Localization Guide.

Path Parameters

  • Name
    :env
    Type
    string
    Description

    Unique identifier of the environment

  • Name
    :code
    Type
    string
    Description

    Unique code of the locale (e.g., "en", "fr", "en_US")


Locale Object

  • Name
    name
    Type
    string
    Description

    Display name of the locale for easier identification in interfaces.

  • Name
    code
    Type
    string
    Description

    Unique locale identifier used throughout the API. Examples: "en", "en_US", "fr", "es".

  • Name
    environment
    Type
    string
    Description

    The environment identifier this locale belongs to.

  • Name
    created_at
    Type
    datetime
    Description

    Timestamp when the locale was created.

  • Name
    is_default
    Type
    bool
    Description

    Whether this locale is the default for the environment. Only one locale can be set as default per environment.


POSTapi.foxnose.net/v1/:env/locales/

Create Locale

Creates a new locale in the specified environment.

Success Response: 201 Created

Attributes

  • Name
    name
    Type
    string
    Required
    required
    Description

    Locale display name

    • Minimum length: 1
    • Maximum length: 100
  • Name
    code
    Type
    string
    Required
    required
    Description

    Unique locale code

    • Minimum length: 1
    • Maximum length: 50
    • Must be alphabetic or contain underscore between alphabetic blocks
    • Must be unique within the environment
  • Name
    is_default
    Type
    bool
    Default
    default:false
    Description

    Set as default locale for the environment

Errors

  • Name
    401 Unauthorized
    Description

    Authentication credentials are missing or invalid.

    • authentication_failed - authentication credentials were not provided or are invalid
  • Name
    403 Forbidden
    Description

    Insufficient permissions to create locales.

    • permission_denied - insufficient permissions to perform this action
  • Name
    404 Not Found
    Description

    The specified environment could not be found.

    • environment_not_found - the specified environment does not exist
  • Name
    422 Unprocessable Content
    Description

    Validation or business logic error. Specific codes:

    • validation_error - validation errors in request data
    • locale_already_exists - locale with the same code already exists in this environment
    • too_many_locales - maximum number of locales for your plan has been reached

Request

POST
/v1/:env/locales/
curl https://api.foxnose.net/v1/7c9h4pwu/locales/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiI..." \
-H "Content-Type: application/json" \
-d '{
    "name": "Français",
    "code": "fr",
    "is_default": false
}'

Response

{
    "name": "Français",
    "code": "fr",
    "environment": "7c9h4pwu",
    "created_at": "2024-09-29T03:49:07.859748-05:00",
    "is_default": false
}

GETapi.foxnose.net/v1/:env/locales/

List All Locales

Retrieves all locales within the specified environment. Returns all results in a single response without pagination.

Success Response: 200 OK

Errors

  • Name
    401 Unauthorized
    Description

    Authentication credentials are missing or invalid.

    • authentication_failed - authentication credentials were not provided or are invalid
  • Name
    403 Forbidden
    Description

    Insufficient permissions to view locales.

    • permission_denied - insufficient permissions to perform this action
  • Name
    404 Not Found
    Description

    The specified environment could not be found.

    • environment_not_found - the specified environment does not exist

Request

GET
/v1/:env/locales/
curl https://api.foxnose.net/v1/7c9h4pwu/locales/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiI..." \
-H "Content-Type: application/json"

Response

[
    {
        "name": "English",
        "code": "en_US",
        "environment": "7c9h4pwu",
        "created_at": "2024-08-02T15:10:47.867952-05:00",
        "is_default": true
    },
    {
        "name": "Français",
        "code": "fr",
        "environment": "7c9h4pwu",
        "created_at": "2024-09-29T03:49:07.859748-05:00",
        "is_default": false
    }
]

GETapi.foxnose.net/v1/:env/locales/:code/

Retrieve Locale

Retrieves details of a specific locale by its code.

Success Response: 200 OK

Errors

  • Name
    401 Unauthorized
    Description

    Authentication credentials are missing or invalid.

    • authentication_failed - authentication credentials were not provided or are invalid
  • Name
    403 Forbidden
    Description

    Insufficient permissions to view this locale.

    • permission_denied - insufficient permissions to perform this action
  • Name
    404 Not Found
    Description

    The specified resource could not be found. Specific codes:

    • environment_not_found - the specified environment does not exist
    • locale_not_found - the specified locale does not exist

Request

GET
/v1/:env/locales/:code/
curl https://api.foxnose.net/v1/7c9h4pwu/locales/fr/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiI..." \
-H "Content-Type: application/json"

Response

{
    "name": "Français",
    "code": "fr",
    "environment": "7c9h4pwu",
    "created_at": "2024-09-29T03:49:07.859748-05:00",
    "is_default": false
}

PUTapi.foxnose.net/v1/:env/locales/:code/

Update Locale

Updates the attributes of a specific locale.

Success Response: 200 OK

Attributes

  • Name
    name
    Type
    string
    Required
    required
    Description

    Locale display name

    • Minimum length: 1
    • Maximum length: 100
  • Name
    code
    Type
    string
    Required
    required
    Description

    Unique locale code

    • Minimum length: 1
    • Maximum length: 50
    • Must be alphabetic or contain underscore between alphabetic blocks
    • Must be unique within the environment
  • Name
    is_default
    Type
    bool
    Default
    default:false
    Description

    Set as default locale for the environment

Errors

  • Name
    401 Unauthorized
    Description

    Authentication credentials are missing or invalid.

    • authentication_failed - authentication credentials were not provided or are invalid
  • Name
    403 Forbidden
    Description

    Insufficient permissions to modify this locale.

    • permission_denied - insufficient permissions to perform this action
  • Name
    404 Not Found
    Description

    The specified resource could not be found. Specific codes:

    • environment_not_found - the specified environment does not exist
    • locale_not_found - the specified locale does not exist
  • Name
    422 Unprocessable Content
    Description

    Validation or business logic error. Specific codes:

    • validation_error - validation errors in request data
    • locale_already_exists - locale with the same code already exists in this environment

Request

PUT
/v1/:env/locales/:code/
curl -X PUT https://api.foxnose.net/v1/7c9h4pwu/locales/fr/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiI..." \
-H "Content-Type: application/json" \
-d '{
    "name": "French",
    "code": "fr",
    "is_default": false
}'

Response

{
    "name": "French",
    "code": "fr",
    "environment": "7c9h4pwu",
    "created_at": "2024-09-29T03:49:07.859748-05:00",
    "is_default": false
}

DELETEapi.foxnose.net/v1/:env/locales/:code/

Delete Locale

Permanently deletes a locale from the environment.

Success Response: 204 No Content

Errors

  • Name
    401 Unauthorized
    Description

    Authentication credentials are missing or invalid.

    • authentication_failed - authentication credentials were not provided or are invalid
  • Name
    403 Forbidden
    Description

    Insufficient permissions to delete this locale.

    • permission_denied - insufficient permissions to perform this action
  • Name
    404 Not Found
    Description

    The specified resource could not be found. Specific codes:

    • environment_not_found - the specified environment does not exist
    • locale_not_found - the specified locale does not exist
  • Name
    422 Unprocessable Content
    Description

    Business logic error. Specific codes:

    • default_locale_cannot_be_deleted - the default locale cannot be deleted

Request

DELETE
/v1/:env/locales/:code/
curl -X DELETE https://api.foxnose.net/v1/7c9h4pwu/locales/fr/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiI..." \
-H "Content-Type: application/json"

Was this page helpful?