====== 3DM Publisher Admin API - Resource Management ====== [[publisher_console_api|Back to the index]] This page describes the resource management API's for 3DM Publisher.\\ Please familiarize yourself with [[publisher_console_api_basics|the basics]] first before continuing. ~~INTOC~~ ===== Model: Resource ===== A ''Resource'' models a physical resource, or an abstract resource with children (a resource group). Properties: ^ Property ^ Required ^ Type ^ Description ^ | id | * | number | Unique identifier. | | name | * | string | User-friendly name of the resource. | | description | | string | Description of the resource. | | file | * | string | File system path to the main file of the resource. | | type | * | string | Type of the resource (usually the file extension). | | thumbnail_image | | string | The resource thumbnail. | | tags | string | | Tags of the resource, serialized to a string. | | is_basemap | | number | Is the resource a basemap? (1 is true, 0 is false) | | is_dem | | number | Is the resource a DEM/Terrain? (1 is true, 0 is false) | | is_lref | | number | Is the resource a Linear Reference? (1 is true, 0 is false) | | resource_metadata | | Array | Metadata of the resource. | | resource_link | | Array | Links to child resources. | | created_at| | string (ISO 8601)| Date of creation of the resource. | | modified_at| | string (ISO 8601) | Date of last modification of the resource. | | refreshed_at| | string (ISO 8601) | Date of last reload of the resource. | Resource Type is defined by: * Resource Type (resource ''type'' property) * Resource Content Type (resource ''content_type'' metadata field) The most-used Resource Types: ^ Resource ^ Resource Type ^ Resource Content Type ^ | Vector Data (ovf) | ovf | - | | Vector Data (ovt) | ovt | - | | Vector Data (odb) | odb | - | | Image (omi) | omi | - | | Image (otm) | otm | - | | Point cloud (opc) | opc | - | | Point cloud (3dtiles) | 3dtiles | pointcloud | | Mapping Resource (mobile) | omr | - | | Mapping Resource (oblique) | omr | oblique | | Mapping Resource (aerial) | omr | uas | | ... | | | Possible values for Resource ''status'': * ''ready''- File is ready for use. * ''missing'' - File was not found on the filesystem. Properties ending on ''_image'' are Base64-encoded JPEG images on create, but will be URL's to the image cache on retrieval. ===== Model: Resource Group ===== A ''Resource Group'' is also just a ''Resource'' object.\\ It has the following defining characteristics: * Resource ''file'' set to ''file.omp'' (for Mapping Resource) or ''file.ogp'' (for all other types). * Resource ''type'' set to ''omp'' (for Mapping Resource) or ''ogp'' (for all other types). * Resource ''group_child_type'' metadata field set to the child resource type * Resource ''group_child_content_type'' metadata field set to the child resource content_type The ''Resource Group Type'' is defined by the ''group_child_type'' and ''group_child_content_type'' metadata fields. ===== Model: ResourceMetadata ===== ^ Property ^ Type ^ Description ^ | name | string | Name of this metadata field. | | value | string | Value of the metadata field. | ===== Model: ResourceLink ===== ^ Property ^ Type ^ Description ^ | child_resource | Resource | Reference to the child resource (only the ''id'' field is required). | ===== Operation: List Resources ===== === Discussion === This operation retrieves all resources and resource groups.\\ Fields: see [[#Model: Resource]] === Request === ''GET'' ''/api/3/resource'' === Response (http 200) === [ { "id": 14, "name": "BE Project", "storage_space": { "id": 1 }, "file": "D:/Data/Run/orbit_mm_run.omr", "type": "omr", "num_bytes": 110, "created_at": "2022-01-03 10:00:32", "modified_at": "2023-04-25 07:21:19", "refreshed_at": "2023-04-25 07:21:19", "status": "ready", "tags": "[]", "is_basemap": 0, "is_dem": 0, "is_lref": 0, "resource_metadata": [ { "name": "panorama_timestamp", "value": "false" }, { "name": "pointcloud_intensity", "value": "false" }, { "name": "dtm_available", "value": "false" }, { "name": "planar_timestamp", "value": "false" }, { "name": "pointcloud_timestamp", "value": "false" }, { "name": "trajectory_timestamp", "value": "false" }, { "name": "pointcloud_rgb", "value": "false" }, { "name": "ortho_available", "value": "false" }, { "name": "mesh_available", "value": "false" } ] }, ... ] ===== Operation: Create Resource ===== === Discussion === * After creation, a resource is also [[#Operation: Reload Resource|reloaded]]. Fields: see [[#Model: Resource]] === Request === ''POST'' ''/api/3/resource'' { "name": "test", "file": "test" } === Response (http 200) === { "id": 199, "name": "test", "storage_space": { "id": 1 }, "file": "test", "type": "", "created_at": "2024-11-27 09:29:37", "modified_at": "2024-11-27 09:29:37", "refreshed_at": "2024-11-27 09:29:37", "status": "missing", "tags": "[]", "is_basemap": 0, "is_dem": 0, "is_lref": 0 } ===== Operation: Update Resource ===== === Discussion === * After creation, a resource is also [[#Operation: Reload Resource|reloaded]]. The following fields can be updated: * name * file * type * description * tags * is_basemap * is_dem * is_lref * thumbnail_image * resource_link * resource_metadata Fields: see [[#Model: Resource]] === Request === ''POST'' ''/api/3/resource/151'' { "name": "BEGE MM06 test" } === Response (http 204) === //No content// ===== Operation: Delete Resource ===== === Discussion === When deleting a resource, it is also removed from all resource groups and publications. === Request === ''DELETE'' ''/api/3/resource/151'' === Response (http 204) === //No content// === Response (http 404) === { "code": "not_found", "message": "Resource with id '151' was not found." } ===== Operation: Create Resource Group ===== === Discussion === Creating a resource group is similar to creating a ''Resource''.\\ To create a resource group, you need to specify the correct properties. See [[#Model: Resource Group]] for more information on these requirements. * After creation, a resource group is also [[#Operation: Reload Resource|reloaded]]. * The ''Resource Type'' of child resources that are added, must match the ''Resource Group Type''. Fields: [[#Model: Resource]] === Request === ''POST'' ''/api/3/resource'' { "name": "Test", "file": "file.omp", "type": "omp", "tags": "[]", "resource_metadata": [ { "name": "collection_start", "value": "2024-11-27" }, { "name": "collection_stop", "value": "2024-11-28" }, { "name": "group_child_type", "value": "omr" }, { "name": "group_child_content_type", "value": "oblique" } ], "resource_link": [ { "child_resource": { "id": 15 } }, { "child_resource": { "id": 157 } } ] } === Response (http 200) === { "id": 200, "name": "Test", "storage_space": { "id": 1 }, "file": "file.omp", "type": "omp", "created_at": "2024-11-27 09:32:57", "modified_at": "2024-11-27 09:32:57", "refreshed_at": "2024-11-27 09:32:57", "status": "ready", "tags": "[]", "is_basemap": 0, "is_dem": 0, "is_lref": 0, "is_wfs": 0, "is_wms": 0, "resource_metadata": [ { "name": "group_child_type", "value": "omr" }, { "name": "collection_stop", "value": "2024-11-28" }, { "name": "group_child_content_type", "value": "" }, { "name": "collection_start", "value": "2024-11-27" } ] } ===== Operation: Update Resource Group ===== === Discussion === Updating a resource group is the same as [[#Operation: Update Resource]] so all the same fields can be updated.\\ Specific to a Resource Group are : * Child resources are set by specifying the resource_link property. * ''Resource Group Type'' is set by updating specific properties and metadata types as described in [[#Model: Resource Group]]. * Child resources must have a ''Resource Type'' that matches the ''Resource Group Type''. * When updating the ''file'' or ''resource_link'' properties, the resource group is also [[#Operation: Reload Resource|reloaded]]. Fields: [[#Model: Resource]]\\ Fields: [[#Model: Resource Group]]\\ Fields: [[#Model: Resource Link]] === Request === ''POST'' ''/api/3/resource/123'' { "resource_link": [ { "child_resource": { "id": 15 } }, { "child_resource": { "id": 157 } } ] } === Response (http 204) === //No content// ===== Operation: Delete Resource Group ===== === Discussion === Deleting a resource group is the same as [[#Operation: Delete Resource]]. ===== Operation: Resource Reload ===== === Discussion === This operation will check if a resource exists on disk and update dynamic fields and metadata. * For a resource: * Update ''num_bytes'' * Update ''status'' * Update ''resource_metadata'' from the metadata.xml file, when it exists. * For a resource group: * Update ''resource_metadata'' by merging metadata of the child resources. === Request === ''GET'' ''/api/3/resource/[resourceId]/refresh'' === Response (http 204) === //No content//