Resources

Resource API: /api/bw/v2/resource

Allows you to add, update, clone or delete Resources in a Boldest platform account. Among many other things, it can also be used to categorize Resources and assign them to existing Maps.


Endpoints

POST /api/bw/v2/resource - Create/Update Resource

Create or update a Resource using JSON data according to Schema.

Request:

  • json (POST body) - Data to import in JSON format according to Schema /api/bw/v2/resource/schema.json

Consult the Schema documentation for the structure of the JSON data.

Response HTTP 200 - Skipped (no update needed):

{
  "done": "Skip Resource TEST111",
  "id": "TEST111",
  "new": false,
  "update": false
}

Response HTTP 201 - Created:

{
  "done": "Create Resource TEST111",
  "id": "TEST111",
  "new": true,
  "update": true
}

Response HTTP 202 - Accepted (updated):

{
  "done": "Update Resource TEST111",
  "id": "TEST111",
  "new": false,
  "update": true
}

Response HTTP 400 - Wrong request:

{
  "fail": "Wrong request"
}

Response HTTP 401 - Unauthorized:

{
  "fail": "Unauthorized"
}

Response HTTP 409 - Conflict (invalid contents):

{
  "fail": "Explanation of the problems encountered"
}

GET /api/bw/v2/resource/{ids} - Get Resources

Retrieve one or more Resources by ID.

Request:

  • /{ids} (path) - Id or Ids in CSV format (Optional)

  • /mapId/{mapId} (path) - Only Resources in Map mapId (Optional) (Omit for all)

  • /published/{1|0|*} (path) - Published status (Optional) (Default: 1)

  • /fields/{fields} (path) - Only these fields (Optional) (Omit for all)

  • /ignoreFields/{fields} (path) - Ignore these fields (Optional) (Omit for none)

  • /excludeFiles (path) - Ignore file fields (Optional) (Omit for none)

Response HTTP 200 - Success:

Resource data in JSON format according to Schema (schema.json or schema.multiple.json)

Response HTTP 400 - Wrong request:

{
  "fail": "Wrong request"
}

Response HTTP 401 - Unauthorized:

{
  "fail": "Unauthorized"
}

Response HTTP 404 - Not found:

{
  "fail": "ERROR: Export fail"
}

DELETE /api/bw/v2/resource/{ids} - Delete Resources

Delete one or more Resources by ID.

Request:

  • /{ids} (path) - Id or Ids in CSV format

Response HTTP 202 - Deleted:

{
  "done": "Deletion of 5 Resources done",
  "count": 5 // Number of Resources deleted
}

Partial deletion:

{
  "done": "Deletion of 3 Resources done",
  "count": 3, // Number of Resources deleted
  "fail": "Deletion of 2 Resources not done",
  "failed": ["TEST114", "TEST115"]
}

Response HTTP 400 - Wrong request:

{
  "fail": "Wrong request"
}

Response HTTP 401 - Unauthorized:

{
  "fail": "Unauthorized"
}

Response HTTP 404 - Not found:

{
  "fail": "No Resources to delete"
}

Response HTTP 409 - Conflict:

{
  "fail": "Deletion of 5 Resources not done"
}

POST /api/bw/v2/resource/batch - Batch Create/Update

Request the Create/Update of a Resource group in a batch process.

Request:

  • json (POST body) - Batch data to import in JSON format according to Schema (schema.multiple.json)

Response HTTP 201 - Created:

{
  "done": "Batch process created",
  "batchId": "22123112345678",
  "count": 123 // Number of Resources to be processed
}

Response HTTP 400 - Wrong request:

{
  "fail": "Wrong request"
}

Response HTTP 401 - Unauthorized:

{
  "fail": "Unauthorized"
}

Response HTTP 409 - Conflict (invalid contents):

{
  "fail": "Explanation of the problems encountered"
}

GET /api/bw/v2/resource/batch/{id} - Batch Status

Query the status of a batch process.

Request:

  • /{id} (path) - Batch process Id

Response HTTP 200 - Success:

{
  "done": "Batch process status",
  "status": "waiting", // "waiting", "processing", "done", "error"
  "dateStatus": "2022-12-31 12:34:56",
  "dateRequest": "2022-12-31 12:34:56",
  "count": 123
}

Response HTTP 400 - Wrong request:

{
  "fail": "Wrong request"
}

Response HTTP 401 - Unauthorized:

{
  "fail": "Unauthorized"
}

Response HTTP 404 - Not found:

{
  "fail": "There is no Resource TEST111 to clone"
}

POST/GET /api/bw/v2/resource/clone/{id} - Clone Resource

Clone a Resource. Optionally can be added to a Map.

Request:

  • /{id} (path) - Id (Optional) (Default: Resource “Base” is cloned)

  • /map/{id} (path) - Id of Map to be added to (Optional)

Response HTTP 201 - Cloned:

{
  "done": "Cloned Resource TEST111 to Resource TEST111_8PtTXiU6mcw",
  "id": "TEST111_8PtTXiU6mcw"
}

Response HTTP 400 - Wrong request:

{
  "fail": "Wrong request"
}

Response HTTP 401 - Unauthorized:

{
  "fail": "Unauthorized"
}

Response HTTP 404 - Not found:

{
  "fail": "There is no Resource TEST111 to clone"
}

Response HTTP 409 - Conflict:

{
  "fail": "Not cloned Resource TEST111"
}

GET /api/bw/v2/resource/schema.json - Get Schema

Get JSON Schema from the data structure of a Resource.

Request:

  • /full (path) - Schema and data (Optional)

Response HTTP 200 - Success:

JSON schema document


GET /api/bw/v2/resource/schema.multiple.json - Get Batch Schema

Get JSON Schema of a group of Resources in a batch process.

Request:

  • /full (path) - Schema and data (Optional)

Response HTTP 200 - Success:

JSON schema document


Resource schema documentation

Properties:

These are the fields used in the JSON for the map creation and update API.


id (required) Type: string. Size: (3, 80)

Unique key that identifies the Resource


published Type: boolean

Visibility of the Resource


timeLastUpdate Type: string. Size: 19

Last update date and time (YYYY-MM-DD HH:MM:SS). Time zone: CET (UTC+1)


title Type: string. Size: (0, 100)

Title of the Resource


shortDescription Type: string (nullable). Size: (0, 160)

Snippet describing the Resource in brief


htmlDescription Type: string (nullable). Size: (0, 1000)

Summary paragraph describing the Resource executively (supports HTML)


htmlContent Type: string (nullable). Size: (0, 32000)

Full content describing the Resource (supports HTML)


image Type: uri (nullable)

Featured image representing the Resource (URL to jpg, png or webp)


multimedia Type: array(Type: uri) (nullable)

Sorted array of images for the multimedia gallery of the Resource (URLs to jpg, png or webp files)


multimediaTitle Type: string. Size: (0, 100)

Title of the multimedia gallery of the Resource


urlAlias Type: string. Size: (2, 500)

URL of the Resource (not full URL. Without protocol and domain. Starts with /)


canonicalUrl Type: uri (nullable). Size: (0, 500)

URL of equivalent external Resource


externalUrl Type: uri (nullable). Size: (0, 500)

URL to which the ‘learn more’ button of the Resource points


externalUrlLabel Type: string (nullable). Size: (0, 250)

Label of the ‘learn more’ button that points to externalUrl


redirectLoadTo Type: string (nullable)

Redirect when loading (clicking) a Resource to an external URL, to an internal Map, to a Landing page or do not redirect


locationLat Type: number (nullable). Size: (-90, 90)

Resource location: Latitude


locationLon Type: number (nullable). Size: (-180, 180)

Resource location: Longitude


locationZoom Type: integer (nullable). Size: (2, 25)

Zoom level to which the map can be adjusted when accessing the Resource information (Google Maps format)


mapIds Type: array(Type: string) (nullable)

Array with the ‘id’ of the Maps where this Resource will appear as PRIMARY (and will only appear in them)


mapIdsAdd Type: array(Type: string) (nullable)

Array with the ‘id’ of the Maps where this Resource will appear as PRIMARY (and will preserve existing Map assignments)


mapSecondaryIds Type: array(Type: string) (nullable)

Array with the ‘id’ of the Maps where this Resource will appear as SECONDARY (and will only appear in them)


mapSecondaryIdsAdd Type: array(Type: string) (nullable)

Array with the ‘id’ of the Maps where this Resource will appear as SECONDARY (and will preserve existing Map assignments)


poiResourceIds Type: array(Type: string) (nullable)

Sorted array with the ‘id’ of the Resources to be displayed as complementary POIs when accessing the Resource information (replace existing ones)


poiResourceIdsAdd Type: array(Type: string) (nullable)

Sorted array with the ‘id’ of the Resources to be displayed as complementary POIs when accessing the Resource information (add to existing ones)


hideInList Type: boolean. Default: False

Hide in widget list


resourceType Type: string

Type of Resource


resourceCategories Type: array(Type: string) (nullable)

Sorted array of ‘id’ of the Category terms assigned to the Resource. The first one will define the icon to be displayed over the marker on the Map


resourceRegions Type: array(Type: string) (nullable)

Array of ‘id’ of geographic areas assigned to the Resource


resourceStage Type: array(Type: string) (nullable)

Array of ‘id’ of labels assigned to the Resource. Used as a sticker to highlight Resources with labels for special offers, highlights, etc…


resourceMapLayerType Type: string

Type of geographic map layer to switch to when the Resource is accessed and the map is centered over it


mapLayerFile Type: uri (nullable)

GIS KML layer to overlay on the map when the Resource is accessed and the map is centered over it (URL to a KML or KMZ file up to 2MB)


contactAddress Type: string (nullable). Size: (0, 200)

Street address of the Resource (e.g. ‘25 Matchett St.’)


contactCity Type: string (nullable). Size: (0, 60)

City name where the Resource is located


contactPostalCode Type: string (nullable). Size: (0, 8)

Postal code where the Resource is located


contactProvince Type: string (nullable). Size: (0, 60)

Province / State / Region where the Resource is located


contactPhone Type: string (nullable). Size: (0, 40)

Contact Phone Number related to the Resource


contactEmail Type: email (nullable). Size: (0, 255)

Contact E-mail Address related to the Resource


contactUrl Type: uri (nullable). Size: (0, 2000)

Website URL related to the Resource. Should start with http:// or https://


openingTimes Type: string (nullable). Size: (0, 2000)

Opening times related to the Resource


ctaOnMap Type: boolean (nullable)

Activate the floating CTA button on the map.


ctaOnImage Type: boolean (nullable)

Activate the floating CTA button on the image.


ctaUrl Type: uri (nullable). Size: (0, 2000)

URL pointed to by the Resource CTA button


ctaLabel Type: string (nullable). Size: (0, 20)

CTA button: text label


ctaValuePrefix Type: string (nullable). Size: (0, 20)

CTA introduction text or pricing: Prefix


ctaValue Type: string (nullable). Size: (0, 20)

CTA introduction text or pricing: label


ctaValueSufix Type: string (nullable). Size: (0, 20)

CTA introduction text or pricing: Sufix


trackCircular Type: boolean (nullable)

Indicates whether the track is a loop route or not. Only for TRACK type Resources


trackEffortDataShow Type: boolean (nullable)

Display the effort information (distance, difficulty, time, elevation, elevation model…) Only fot TRACK type Resources


trackAltitudeShow Type: boolean (nullable)

Display the track elevation model graph. Only for TRACK resource files with elevation data in the GPX/KML file


trackHoverShow Type: boolean (nullable)

True: the TRACK Resource is displayed on the map when hovering/tapping on a marker at the starting point of the path. False: the track is always displayed on the map.


trackDurationMinutes Type: integer (nullable). Size: (1, *)

Route duration (minutes). Only for TRACK resources


trackTravelDistance Type: integer (nullable). Size: (1, *)

Route length (meters). Only for TRACK resources


trackSlopeUp Type: integer (nullable). Size: (0, *)

Ascent gradient of the route (meters). Only for TRACK resources


trackSlopeDown Type: integer (nullable). Size: (0, *)

Descent gradient of the route (meters). Only for TRACK resources


trackDifficulty Type: integer (nullable). Enum: [None, 1, 2, 3, 4, 5]

Difficulty level of the route (1: very low - 5: extreme). Only for TRACK resources


trackStart Type: string (nullable). Size: (0, 100)

Starting point of the route (name of the place). Only for TRACK resources


trackEnd Type: string (nullable). Size: (0, 100)

Ending point of the route (name of the place). Only for TRACK resources


trackFile Type: uri (nullable)

URL from which the track of the route can be imported (GPX or KML file). Only for TRACK resources


headTitle Type: string (nullable). Size: (0, 100)

SEO title (title tag). If not set, the ‘title’ field will be used


headDescription Type: string (nullable). Size: (0, 150)

SEO description (meta description). If not set, the ‘shortDescription’ field will be used


headKeywords Type: string (nullable). Size: (0, 150)

SEO keywords (meta keywords).


deleteElementIrreversibly Type: boolean

If true, the Resource will be deleted irreversibly


Language information

This schema includes certain fields which have multiple languages support.

The following fields have multiple languages support:

  • title

  • shortDescription

  • htmlDescription

  • htmlContent

  • urlAlias

  • canonicalUrl

  • externalUrl

  • externalUrlLabel

  • ctaValuePrefix

  • ctaValue

  • ctaValueSufix

  • ctaLabel

  • openingTimes

  • trackStart

  • trackEnd

  • headKeywords

  • headTitle

  • headDescription

When you use the name of this fields without the suffix with language you are referring to the field in the default language.

If you want to use a field in a different language, you must add to the field name the language code separated by an underscore (_).

For example, if the proyect have English language and you want to use the field title in English language, you must add the language code en to the field name as title_en.