Retrieve locale schema

  • Countries
  • Services
  • 2 routes
How to retrieve the validation schema for a resource in a given locale or country?

This scenario explains how to retrieve the validation schema associated with a Club Med API resource for a given locale or country. It helps an API consumer discover which locale values are available, then request the JSON schema used to validate a resource such as profile or billing.

Overview

Use this scenario when an application must validate payloads against the schema expected by a Club Med API resource. The flow starts by listing the locales available for the current API key, then retrieves the schema for the target resource and locale.

Prerequisites

  • A valid x-api-key.
  • The target resource value. With the sources available for this scenario, supported values are profile and billing.
  • A localeOrCountry compatible with the route, such as a country code or a locale returned by GET/v0/locales.
  • If your integration depends on a proposal context, proposal_id can be passed when relevant.

NOTE

The schema response follows a JSON Schema format and can be used to validate client-side or server-side payloads before submitting them to another API route.

Process workflow

Legend:
Mandatory
Optional
1

List available locales

Mandatory

Use GET/v0/locales to list the locales available for the current API key before calling a route that depends on a locale or country.

Prerequisites

  • A valid x-api-key.

Calling CURL

curl -X 'GET' \
  'https://api.clubmed.com/v0/locales' \
  -H 'accept: application/json' \
  -H 'x-api-key: YOUR_API_KEY'

Example answer

[
  "fr-FR",
  "fr-BE",
  "nl-BE",
  "de-CH",
  "fr-CH",
  ...
]

Info: reuse one of the returned locale values to build the next request to GET/v3/schemas/{resource}/{localeOrCountry} when your integration depends on locale-specific validation.


Response codes

  • OK Response (200): returns the list of locales supported for the current API key.
  • Error (400): bad_request or validation_error.
  • Error (401): not documented in Swagger.
  • Error (403): forbidden when the API key is not allowed to access the route.
  • Error (404): not documented in Swagger.
GET/v0/locales
See more
2

Retrieve the resource schema

Mandatory

Use GET/v3/schemas/{resource}/{localeOrCountry} to retrieve the JSON Schema associated with a resource and a target locale or country.

Prerequisites

  • A valid x-api-key.
  • A supported resource value. With the available sources, documented values are profile and billing.
  • A localeOrCountry value compatible with the route, such as fr-FR or FR.
  • If the request depends on a proposal context, an optional proposal_id.

Calling CURL

curl -X 'GET' \
  'https://api.clubmed.com/v3/schemas/profile/fr-FR?proposal_id=123456' \
  -H 'accept: application/json' \
  -H 'x-api-key: YOUR_API_KEY'

Example answer

{
  "title": "ProfileSchema_fr-FR",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://api-test/v1/schemas/resource/fr-FR",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "string"
  ],
  "definitions": "string",
  "properties": "string"
}

Info: reuse the returned required and properties keys to drive client-side or server-side validation before submitting payloads to another route.


Response codes

  • OK Response (200): returns the JSON Schema for the requested resource and locale or country.
  • Error (400): invalid or missing input, including bad_request or validation_error.
  • Error (401): not documented in Swagger.
  • Error (404): not_found when no schema matches the requested combination.
GET/v3/schemas/{resource}/{localeOrCountry}
See more