Difference between revisions of "Unify Monthly Data"

From Fusion Registry Wiki
Jump to navigation Jump to search
(Web Service)
 
(11 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
[[Category:How_To]]
 +
[[Category:WebService]]
 
=Overview=
 
=Overview=
The Registry has the ability to unify monthly data so that the formats: yyyy-mm and yyyy-Mmm are considered the same on a data input.  By default the Registry will treat the dates 2000-01 and 2000-M01 as different observation times. If you wish these to be represented as the same format (either with or without the "M" character this can be enabled in the Registry
+
The Registry has the ability to unify monthly data so that the formats: yyyy-mm and yyyy-Mmm are considered the same on a data input.  By default the Registry will treat the dates 2000-01 and 2000-M01 as different observation times. If you wish these to be represented as the same format (either with or without the "M" character) this can be enabled in the Registry. In Registry version 10.5.7 there is no User Interface for this feature and it must be enabled by invoking a Web Service.
  
==Web Service==
+
There are 3 modes that the Registry can be in:
There are two Web Services - one for setting the way the Registry works and the other for  
+
* '''''Default mode''''': 2001-01 and 2001-M01 are considered different observation times
 +
* '''''Include the "M" Character''''': when data is read or output by the system yyyy-mm values are converted into yyyy-Mmm. 2001-01 would be output as 2001-M01. Attempting to load data with both 2001-01 and 2001-M01 will result in a duplicate observation.
 +
* '''''Excluding the "M" Character''''': when data is read or output by the system yyyy-Mmm values are converted into yyyy-mm. 2001-M01 would be output as 2001-01. Attempting to load data with both 2001-01 and 2001-M01 will result in a duplicate observation.
 +
 
 +
=Web Services=
 +
There are two Web Services: one for setting the way the Registry interprets monthly dates and the other for returning the current way that the Registry is set up.
  
 
=== Setting the Monthly Format ===
 
=== Setting the Monthly Format ===
Line 10: Line 17:
 
This is a secure Web Service, so Authentication Credentials must be provided.
 
This is a secure Web Service, so Authentication Credentials must be provided.
  
This takes a JSON Object which has a single field "MonthlyDataFormat".  Valid values for this are: "", "INCLUDE_M_CHARACTER", "EXCLUDE_M_CHARACTER"
+
The Web Service takes a JSON Object which has a single field "MonthlyDataFormat".  Valid values for this are: "", "INCLUDE_M_CHARACTER", "EXCLUDE_M_CHARACTER"
  
 
An example of Valid JSON:
 
An example of Valid JSON:
Line 19: Line 26:
 
</pre>
 
</pre>
  
=== Getting the Registry's Format ===
+
=== Getting the Current Monthly Format ===
 
Issue a '''GET''' request to the URL:  <registry location>/ws/secure/settings/getDataFrequencyFormat
 
Issue a '''GET''' request to the URL:  <registry location>/ws/secure/settings/getDataFrequencyFormat
  
Line 27: Line 34:
 
<pre>
 
<pre>
 
{
 
{
   "MonthlyDataFormat": "INCLUDE_M_CHARACTER"
+
   "MonthlyDataFormat": "EXCLUDE_M_CHARACTER"
 
}
 
}
 
</pre>
 
</pre>
  
 
==Examples==
 
==Examples==
POST requests cannot be made from a Web Browser (whereas GET requests can).  A tool such as POSTMAN
+
POST requests cannot be made from a Web Browser (whereas GET requests can).  A tool such as POSTMAN or curl can be used.
 +
 
 +
This is an example curl command that can be used to set the Registry to unify the dates so that the "M" character is always output. The username is "admin", the password is "pwd" and the Registry has been deployed to MyServer.com
 +
 
 +
<pre>
 +
curl --header "Content-Type: application/json" \
 +
  --request POST \
 +
  --data '{"MonthlyDataFormat": "INCLUDE_M_CHARACTER"}' \
 +
  --user admin:pwd \
 +
  http://MyServer.com/ws/secure/settings/setDataFrequencyFormat
 +
</pre>

Latest revision as of 00:39, 11 September 2023

Overview

The Registry has the ability to unify monthly data so that the formats: yyyy-mm and yyyy-Mmm are considered the same on a data input. By default the Registry will treat the dates 2000-01 and 2000-M01 as different observation times. If you wish these to be represented as the same format (either with or without the "M" character) this can be enabled in the Registry. In Registry version 10.5.7 there is no User Interface for this feature and it must be enabled by invoking a Web Service.

There are 3 modes that the Registry can be in:

  • Default mode: 2001-01 and 2001-M01 are considered different observation times
  • Include the "M" Character: when data is read or output by the system yyyy-mm values are converted into yyyy-Mmm. 2001-01 would be output as 2001-M01. Attempting to load data with both 2001-01 and 2001-M01 will result in a duplicate observation.
  • Excluding the "M" Character: when data is read or output by the system yyyy-Mmm values are converted into yyyy-mm. 2001-M01 would be output as 2001-01. Attempting to load data with both 2001-01 and 2001-M01 will result in a duplicate observation.

Web Services

There are two Web Services: one for setting the way the Registry interprets monthly dates and the other for returning the current way that the Registry is set up.

Setting the Monthly Format

Issue a POST request to the URL: <registry location>/ws/secure/settings/setDataFrequencyFormat

This is a secure Web Service, so Authentication Credentials must be provided.

The Web Service takes a JSON Object which has a single field "MonthlyDataFormat". Valid values for this are: "", "INCLUDE_M_CHARACTER", "EXCLUDE_M_CHARACTER"

An example of Valid JSON:

{
  "MonthlyDataFormat": "INCLUDE_M_CHARACTER"
}

Getting the Current Monthly Format

Issue a GET request to the URL: <registry location>/ws/secure/settings/getDataFrequencyFormat

This is a secure Web Service, so Authentication Credentials must be provided.

A JSON Object will be returned which will state how the Registry has been configured. An example:

{
  "MonthlyDataFormat": "EXCLUDE_M_CHARACTER"
}

Examples

POST requests cannot be made from a Web Browser (whereas GET requests can). A tool such as POSTMAN or curl can be used.

This is an example curl command that can be used to set the Registry to unify the dates so that the "M" character is always output. The username is "admin", the password is "pwd" and the Registry has been deployed to MyServer.com

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"MonthlyDataFormat": "INCLUDE_M_CHARACTER"}' \
  --user admin:pwd \
  http://MyServer.com/ws/secure/settings/setDataFrequencyFormat