Transaction Web Service

From FMR Knowledge Base
Jump to navigation Jump to search

Overview

The Transaction Web Service provides access to all the structural metadata content of the Fusion Metadata Registry (including any content that has been subsequently deleted). A Transaction is the submission of a structure, group of structures or data registration.

Querying and Searching All Transactions

Returns a JSON Array of all of the structures in the Registry, filterable by parameter.

Entry Point /ws/registry/tx/searchTransactions
Access Public
Http Method GET
Response Format application/json
Response Statuses

200 - Submission Accepted

Response

The output shows the Date (as a millisecond epoch time), the Transaction Id, the action and the Transaction Type. A typical example:

 [
   {
     "Date": 1612434466642,
     "Id": 785,
     "Action": "Replace",
     "Type": "Structure Submission"
   },
   {
     "Date": 1612434448408,
     "Id": 784,
     "Action": "Replace",
     "Type": "Structure Submission"
   },
   ...
 ]


HTTP Query Parameters

If no parameters are supplied all transactions known to the Registry will be returned. If any of the filters applied below result in no results, an empty JSON response (HTTP 200) is returned.

Request Parameter Required Purpose
action No Filters the response to only include Transaction for the specified action. Legal values are Append, Replace, FullReplace and Delete.
dateFrom No Filters the response to only include Transactions from the specified time. The value must be specified as the epoch time in milliseconds (e.g. 1609459200000 is the start of the year 2021).
dateTo No Filters the response to only include Transactions up to the specified time. The value must be specified as the epoch time in milliseconds (e.g. 1609459200000 is the start of the year 2021).
max No Limits the returned response to only containing at most the specified value.
orderDesc No The default output is that Transactions are returned in a descending order (most recent first). Supplying false to this parameter reverses the order.
user No Filters the response to only include Transactions for the specified user.

Querying for all URNs

Returns a JSON Array of all the maintainable URNs (both current and deleted) in the Registry.

Entry Point /ws/registry/tx/getAllUrns
Access Public
Http Method GET
Response Format application/json
Response Statuses

200 - Submission Accepted

Response

An alphabetically ordered list of all of the URNs in the system. A typical example:

 [
   "urn:sdmx:org.sdmx.infomodel.codelist.Codelist=SDMX:CL_BAR(1.0)",
   "urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=AAA.SUB1:DF1(1.0)",
   "urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=WB:WDI_POVERTY(1.0)",
   "urn:sdmx:org.sdmx.infomodel.registry.ProvisionAgreement=BIS.LBS:TLBR_WS8_BIS_PH2(1.0)",
   ...
 ]

Querying for a specific URN

Provides information regarding who made changes to a particular structure. It returns the user id (and date, transaction id and action) of who last modified the maintainable with the given URN.

Entry Point /ws/registry/tx/history
Access Public Note: More information is provided if authenticated
Http Method GET
Response Format application/json
Response Statuses

200 - Submission Accepted

400 - Illegal URN

Response

An ordered list of transactions (lowest transaction number first) of the transactions for the specified URN, showing the date, transaction ID and Action. A typical example:

 [
   {
     "Date": 1612358238673,
     "Id": 449,
     "Action": "Replace",
     "Type": "Structure Submission"
   },
   {
     "Date": 1612358239170,
     "Id": 450,
     "Action": "Delete",
     "Type": "Structure Submission"
   },
   {
     "Date": 1612358239657,
     "Id": 451,
     "Action": "Replace",
     "Type": "Structure Submission"
   },
   ...
 ]

If the query is provided with correct authentication credentials of an administrator then the User ID of the user who performed the change is also returned. An example of this:

 [
   {
     "Date": 1612358238673,
     "Id": 449,
     "User": "admin1",
     "Action": "Replace",
     "Type": "Structure Submission"
   },

HTTP Query Parameters

Request Parameter Required Purpose
urn Yes The URN of the requested structure.

Querying for a specific Transaction

For a specific Transaction ID, all of the structures can be requested for that Transaction.

Entry Point /ws/registry/tx/transactions
Access Public
Http Method GET
Response Format application/json SDMX
Response Statuses

200 - Submission Accepted

Response

The output will be in the format requested, showing all of the structures for the specific transaction. An example showing SDMX-ML 2.1 for a Dataflow:

 <?xml version="1.0" encoding="UTF-8"?>
 <mes:RegistryInterface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:mes="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message" xmlns:str="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/structure" xmlns:com="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common" xsi:schemaLocation="http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message https://registry.sdmx.org/schemas/v2_1/SDMXMessage.xsd">
   <mes:Header>
     <mes:ID>IREF422205</mes:ID>
     <mes:Test>false</mes:Test>
     <mes:Prepared>2021-02-04T12:37:05Z</mes:Prepared>
     <mes:Sender id="REGISTRY1"/>
     <mes:Receiver id="not_supplied"/>
   </mes:Header>
   <mes:SubmitStructureRequest action="Information">
     <str:Structures>
       <str:Dataflows>
         <str:Dataflow urn="urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=ESTAT:HC02(2.0)" isExternalReference="false" agencyID="ESTAT" id="HC02" isFinal="false" version="2.0">
           <com:Name xml:lang="en">HC02 - Population by Household Status and Educational Attainment</com:Name>
           <str:Structure>
             <Ref package="datastructure" agencyID="ESTAT" id="HC02" version="1.0" class="DataStructure"/>
           </str:Structure>
         </str:Dataflow>
       </str:Dataflows>
     </str:Structures>
   </mes:SubmitStructureRequest>
 </mes:RegistryInterface>

HTTP Query Parameters

Request Parameter Required Purpose
urn Yes The URN of the requested structure.
format No A structure format. Default output is SDMX-ML 2.1. Other options include sdmx-json, fusion-json, sdmx-edi.

Last User to Edit a Structure

Returns only the user id of the last user to edit a specific structure.

Entry Point /ws/registry/tx/userIdFromReg
Access Public
Http Method GET
Response Format application/json

Response

An example output

  {"userId":"admin1"}

HTTP Query Parameters

Request Parameter Required Purpose
urn Yes The URN of the requested structure.