# Maps ## Map API: `/api/bw/v2/map` API BW version 2 (Beta) Allows you to add, update, clone or delete Maps in a Boldest platform account. Among many other things, it can also be used to assign Resources to Maps. ## Methods ### POST: Create/Update Map - POST `json` Data to import in JSON format according to Schema /api/bw/v2/map/schema.json Consult the [**`Schema documentation`**](#map-schema-documentation) for the structure of the JSON data. **RESULT**: `HTTP 200` Skipped. The Map exists and does not need to be updated ```json { "done": "Skip Map TEST111", "id": "TEST111", "new": false, "update": false } ``` `HTTP 201` Created. The Map did not exist and was therefore created ```json { "done": "Create Map TEST111", "id": "TEST111", "new": true, "update": true } ``` `HTTP 202` Accepted. The Map existed and was therefore updated ```json { "done": "Update Map TEST111", "id": "TEST111", "new": false, "update": true } ``` `HTTP 400` Wrong request ```json { "fail": "Wrong request" } ``` `HTTP 401` Unauthorized ```json { "fail": "Unauthorized" } ``` `HTTP 409` Conflict. The submitted contents are not valid ```json { "fail": "Explanation of the problems encountered" } ``` ### GET: Get Map/s - `/{ids}` Id or Ids CSV format (Optional) - `/published/{1|0|*}` Published (Optional) (Default:1) - `/fields/{fields}` Only these fields (Optional) (Default:All) - `/ignoreFields/{fields}` Ignore these fields (Optional) (Default:None) - `/excludeFiles` Ignore file fields (Optional) (Default:No) **RESULT**: `HTTP 200` Success Map data in JSON format according to Schema (schema.json or schema.multiple.json) `HTTP 400` Wrong request ```json { "fail": "Wrong request" } ``` `HTTP 401` Unauthorized ```json { "fail": "Unauthorized" } ``` `HTTP 404` Not found ```json { "fail": "ERROR: Export fail" } ``` ``` ### DELETE: Delete Map/s - `/{ids}` Id or Ids CSV format **RESULT**: `HTTP 202` Deleted ```json { "done": "Deletion of 5 Maps done", "count": 5 // Number of Maps deleted } ``` Partial deletion ```json { "done": "Deletion of 3 Maps done", "count": 3, // Number of Maps deleted "fail": "Deletion of 2 Maps not done", "failed": ["TEST114", "TEST115"] } ``` `HTTP 400` Wrong request ```json { "fail": "Wrong request" } ``` `HTTP 401` Unauthorized ```json { "fail": "Unauthorized" } ``` `HTTP 404` Not found ```json { "fail": "No Maps to delete" } ``` `HTTP 409` Conflict. The submitted contents are not valid ```json { "fail": "Deletion of 5 Maps not done" } ``` ### POST: Request the Create/Update of a Map group in a batch process - `/batch` Command - POST `json` Batch data to import in JSON format according to Schema (schema.multiple.json) **RESULT**: `HTTP 201` Created. The Map did not exist, it is created ```json { "done": "Batch process created", "batchId": "22123112345678", "count": 123 // Number of Maps to be processed } ``` `HTTP 400` Wrong request ```json { "fail": "Wrong request" } ``` `HTTP 401` Unauthorized ```json { "fail": "Unauthorized" } ``` `HTTP 409` Conflict. The submitted contents are not valid ```json { "fail": "Explanation of the problems encountered" } ``` ### GET: Query the status of a batch process - `/batch` Command - `/{id}` Batch process Id **RESULT** `HTTP 200` Success ```json { "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 } ``` `HTTP 400` Wrong request ```json { "fail": "Wrong request" } ``` `HTTP 401` Unauthorized ```json { "fail": "Unauthorized" } ``` `HTTP 404` Error ```json { "fail": "There is no Map TEST111 to clone" } ``` ### POST/GET: Clone a Map. Optionally can be added to a Map - `/clone` Command - `/{id}` Id (Optional) (Default: Map "Base" is cloned) **RESULT**: `HTTP 201` Cloned ```json { "done": "Cloned Map TEST111 to Map TEST111_8PtTXiU6mcw", "id": "TEST111_8PtTXiU6mcw" } ``` `HTTP 400` Wrong request ```json { "fail": "Wrong request" } ``` `HTTP 401` Unauthorized ```json { "fail": "Unauthorized" } ``` `HTTP 404` Error ```json { "fail": "There is no Map TEST111 to clone" } ``` `HTTP 409` Fail ```json { "fail": "Not cloned Map TEST111" } ``` ### GET: Get Schema JSON from the data structure of a Map - `/full` Schema and data (Optinal) - `/schema.json` JSON schema for import **RESULT**: `HTTP 200` Success JSON schema document ### GET: Get Schema JSON schema of a group of Maps in a batch process - `/full` Schema and data (Optinal) - `/schema.multiple.json` Schema for batch import JSON **RESULT**: `HTTP 200` Success JSON schema document (map-schema-documentation)= ```{include} map.schema.json.md.merge :parser: myst_parser.sphinx_