Difference between revisions of "Delete Structures Web Service"

From FMR Knowledge Base
Jump to navigation Jump to search
(curl example)
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:FMR REST API Reference]]
 
[[Category:FMR REST API Reference]]
 +
= Overview =
 +
Fusion Metadata Registry provides a web service for '''deleting''' structural metadata.
  
= Overview =  
+
Deletion always concerns one maintainable artefact or one item in the case of Codelists and other item schemes:
Fusion Registry provides a web service for the import of structural metadata. This can be in any supported structure format, with the information supplied as a file, zip file, in the HTTP body.
+
* A fully identified Maintainable Artefact, for example <code>codelist/SDMX/CL_FREQ/1.0</code>
 +
* A fully identified Item, for example <code>codelist/SDMX/CL_FREQ/1.0/M</code>
 +
 
 +
== Method ==
 +
Delete an artefact using the HTTP <code>DELETE</code> method, the <code>/ws/secure/sdmxapi/rest/</code> REST API entry point and by specifying the <em>type</em> and <em>identity</em> of the artefact to the delete on the URL path.
 +
 
 +
Examples:
 +
* DELETE <code>http://registry.mydomain.org/ws/secure/sdmxapi/rest/codelist/SDMX/CL_FREQ/1.0</code>
 +
* DELETE <code>http://registry.mydomain.org/ws/secure/sdmxapi/rest/codelist/SDMX/CL_FREQ/1.0/M</code>
 +
 
 +
== curl examples ==
 +
Delete the complete Codelist
 +
  curl -X DELETE -u "root:password" "http://localhost:8080/ws/secure/sdmxapi/rest/codelist/SDMX/CL_FREQ/1.0"
 +
 
 +
Delete just the 'M' code from the CL_FREQ Codelist
 +
  curl -X DELETE -u "root:password" "http://localhost:8080/ws/secure/sdmxapi/rest/codelist/SDMX/CL_FREQ/1.0/M"
 +
 
 +
== Artefact types ==
 +
When constructing the URL, the artefact type is the same as those for the [https://github.com/sdmx-twg/sdmx-rest/blob/v2.2.1/doc/structures.md SDMX v2 structure query], and can be one of the following:
 +
 
 +
datastructure, metadatastructure, categoryscheme, conceptscheme, codelist, hierarchy, hierarchyassociation, valuelist, agencyscheme, dataproviderscheme, metadataproviderscheme, dataconsumerscheme, organisationunitscheme, dataflow, metadataflow, reportingtaxonomy, provisionagreement, metadataprovisionagreement, structuremap, representationmap, conceptschememap, categoryschememap, organisationschememap, reportingtaxonomymap, process, categorisation, dataconstraint, metadataconstraint, transformationscheme, rulesetscheme, userdefinedoperatorscheme, customtypescheme, namepersonalisationscheme, vtlmappingscheme
 +
 
 +
== Deleting artefacts referenced by others ==
 +
Artefacts can only be deleted if they are not referenced by others.
 +
 
 +
If an artefact is referenced, a delete request will be rejected with HTTP status <code>400</code>. In these cases, referencing artefacts must be deleted first.
  
The Fusion Registry import actions can be used to tell the service how to treat the incoming information (Appned, Repace, Delete, Full Replace, Merge).
+
== Response ==
 +
An SDMX-ML Submit Structure Response Message is returned as the response. For example:
 +
  <?xml version='1.0' encoding='UTF-8'?>
 +
  <message:RegistryInterface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:message="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message" xmlns:com="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common" xmlns:reg="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/registry">
 +
    <message:Header>
 +
      <message:ID>IREF971813</message:ID>
 +
      <message:Test>false</message:Test>
 +
      <message:Prepared>2022-07-28T10:06:25Z</message:Prepared>
 +
      <message:Sender id="Unknown"/>
 +
    </message:Header>
 +
    <message:SubmitStructureResponse>
 +
      <reg:SubmissionResult>
 +
        <reg:SubmittedStructure action="Delete">
 +
          <reg:MaintainableObject>
 +
            <URN>urn:sdmx:org.sdmx.infomodel.codelist.Codelist=SDMX:CL_FREQ(1.0)</URN>
 +
          </reg:MaintainableObject>
 +
        </reg:SubmittedStructure>
 +
        <reg:StatusMessage status="Success"/>
 +
      </reg:SubmissionResult>
 +
    </message:SubmitStructureResponse>
 +
  </message:RegistryInterface>
  
 +
== Summary ==
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 12: Line 60:
 
|style="background-color:#eaecf0"|<b>Access</b>|| <span style='color:red'><b>Secure</b></span> Agency and Admin only
 
|style="background-color:#eaecf0"|<b>Access</b>|| <span style='color:red'><b>Secure</b></span> Agency and Admin only
 
|-
 
|-
|style="background-color:#eaecf0"|<b>Autnentication</b>|| HTTP Basic Authentication, Certificate Autentication
+
|style="background-color:#eaecf0"|<b>Authentication</b>|| HTTP Basic Authentication
|-
 
|style="background-color:#eaecf0"|<b>Http Method</b>|| POST
 
 
|-
 
|-
|style="background-color:#eaecf0"|<b>Accepts</b>|| XLSX, SDMX-ML, SDMX-EDI (any format for which there is a Structure Reader)
+
|style="background-color:#eaecf0"|<b>Http Method</b>|| DELETE
 
|-
 
|-
|style="background-color:#eaecf0"|<b>Compression</b> || Zip files supported, if loading from URL gzip responses supported
+
|style="background-color:#eaecf0"|<b>Accepts</b>|| None - the request must have no content
 
|-
 
|-
|style="background-color:#eaecf0"|<b>Content-Type</b>|| <p>1. multipart/form-data (if attaching file) – the attached file must be in field name of uploadFile</p>
+
|style="background-color:#eaecf0"|<b>Content-Type</b>|| None - the request must have no content
<p>2. application/text or application/xml (if submitting data in the body of the POST)</p>
 
 
|-
 
|-
 
|style="background-color:#eaecf0"|<b>Response Format</b>|| SDMX-ML Submit Structure Response Message (XML)
 
|style="background-color:#eaecf0"|<b>Response Format</b>|| SDMX-ML Submit Structure Response Message (XML)
 
|-
 
|-
|style="background-color:#eaecf0"|<b>Response Statuses</b>|| <p><b>200</b> - Submission Success</p>
+
|style="background-color:#eaecf0"|<b>Response Statuses</b>|| <p><b>200</b> - Deletion success</p>
<p><b>400</b> - Submission could not be performed (either an unreadable dataset, or unresolvable reference to a required structure)</p>
+
<p><b>400</b> - Deletion unsuccessful </p>
 
<p><b>401</b> - Unauthorized (if access has been restricted)</p>
 
<p><b>401</b> - Unauthorized (if access has been restricted)</p>
 
<p><b>500</b> - Server Error</p>
 
<p><b>500</b> - Server Error</p>
|}
 
 
 
= HTTP Headers =
 
{| class="wikitable"
 
|-
 
!|HTTP Header || Purpose || Allowed Values
 
|-
 
|style="background-color:#eaecf0"|<b>ACTION</b>|| If not present in the structure message, the action is used to inform the server how to process the structures. ||
 
<ul>
 
<li>DELETE</li>
 
</ul>
 
 
 
|}
 
|}

Latest revision as of 09:23, 26 August 2025

Overview

Fusion Metadata Registry provides a web service for deleting structural metadata.

Deletion always concerns one maintainable artefact or one item in the case of Codelists and other item schemes:

  • A fully identified Maintainable Artefact, for example codelist/SDMX/CL_FREQ/1.0
  • A fully identified Item, for example codelist/SDMX/CL_FREQ/1.0/M

Method

Delete an artefact using the HTTP DELETE method, the /ws/secure/sdmxapi/rest/ REST API entry point and by specifying the type and identity of the artefact to the delete on the URL path.

Examples:

curl examples

Delete the complete Codelist

 curl -X DELETE -u "root:password" "http://localhost:8080/ws/secure/sdmxapi/rest/codelist/SDMX/CL_FREQ/1.0"

Delete just the 'M' code from the CL_FREQ Codelist

 curl -X DELETE -u "root:password" "http://localhost:8080/ws/secure/sdmxapi/rest/codelist/SDMX/CL_FREQ/1.0/M"

Artefact types

When constructing the URL, the artefact type is the same as those for the SDMX v2 structure query, and can be one of the following:

datastructure, metadatastructure, categoryscheme, conceptscheme, codelist, hierarchy, hierarchyassociation, valuelist, agencyscheme, dataproviderscheme, metadataproviderscheme, dataconsumerscheme, organisationunitscheme, dataflow, metadataflow, reportingtaxonomy, provisionagreement, metadataprovisionagreement, structuremap, representationmap, conceptschememap, categoryschememap, organisationschememap, reportingtaxonomymap, process, categorisation, dataconstraint, metadataconstraint, transformationscheme, rulesetscheme, userdefinedoperatorscheme, customtypescheme, namepersonalisationscheme, vtlmappingscheme

Deleting artefacts referenced by others

Artefacts can only be deleted if they are not referenced by others.

If an artefact is referenced, a delete request will be rejected with HTTP status 400. In these cases, referencing artefacts must be deleted first.

Response

An SDMX-ML Submit Structure Response Message is returned as the response. For example:

 <?xml version='1.0' encoding='UTF-8'?>
 <message:RegistryInterface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:message="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message" xmlns:com="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common" xmlns:reg="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/registry">
   <message:Header>
     <message:ID>IREF971813</message:ID>
     <message:Test>false</message:Test>
     <message:Prepared>2022-07-28T10:06:25Z</message:Prepared>
     <message:Sender id="Unknown"/>
   </message:Header>
   <message:SubmitStructureResponse>
     <reg:SubmissionResult>
       <reg:SubmittedStructure action="Delete">
         <reg:MaintainableObject>
           <URN>urn:sdmx:org.sdmx.infomodel.codelist.Codelist=SDMX:CL_FREQ(1.0)</URN>
         </reg:MaintainableObject>
       </reg:SubmittedStructure>
       <reg:StatusMessage status="Success"/>
     </reg:SubmissionResult>
   </message:SubmitStructureResponse>
 </message:RegistryInterface>

Summary

Entry Point /ws/secure/sdmxapi/rest/
Access Secure Agency and Admin only
Authentication HTTP Basic Authentication
Http Method DELETE
Accepts None - the request must have no content
Content-Type None - the request must have no content
Response Format SDMX-ML Submit Structure Response Message (XML)
Response Statuses

200 - Deletion success

400 - Deletion unsuccessful

401 - Unauthorized (if access has been restricted)

500 - Server Error