mrx-register api v1.0.0-oas3.1

25 minute read

metarex register api specification

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

mrx-reg-svr

The OpenAPI Schema for the MetaRex register To find out more about MetaRex and our mission, visit the website .

This handles creating and getting of simple register entries, as well as admin areas and finding out whats currently in the register.

Developer Design Choices

Here is the list of choices we have made in the design of the register, that may not be noticeable from reading the specification.

1. Handling a Trailing /

The trailing / is not explicitly declared in the path OpenAPI specification, mainly to reduce bloating the schema with duplicated fields and to reduce errors for autogenerating server code based on the specification. For the ease of integration into different proxies such as NGINX then a design decision has been taken to allow the register to handle them.

For example /reg and /reg/ are expected to give the same response, as are /reg?limit=20 and /reg/?limit=20. In the demo server , this is achieved by stripping the trailing / from the URL of any requests.

Email: Support License: BSD 3 Clause

Authentication

ScopeScope Description
readGrants read access
writeGrants write access
adminGrants access to admin operations

Default

get__test

Code samples

1
2
3
# You can also use wget
curl -X GET /test \
  -H 'Accept: text/plain'
1
2
3
GET /test HTTP/1.1

Accept: text/plain
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16

const headers = {
  'Accept':'text/plain'
};

fetch('/test',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/plain'
}

result = RestClient.get '/test',
  params: {
  }, headers: headers

p JSON.parse(result)
1
2
3
4
5
6
7
8
import requests
headers = {
  'Accept': 'text/plain'
}

r = requests.get('/test', headers = headers)

print(r.json())
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'text/plain',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/test', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
URL obj = new URL("/test");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"text/plain"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/test", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /test

Example responses

200 Response

"string"

Responses

StatusMeaningDescriptionSchema
200OKself test passstring
400Bad Requesttest failedNone

public

Public access operations - unsecured

searchRegisterEntries

Code samples

1
2
3
# You can also use wget
curl -X GET /reg \
  -H 'Accept: application/json'
1
2
3
GET /reg HTTP/1.1

Accept: application/json
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16

const headers = {
  'Accept':'application/json'
};

fetch('/reg',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/reg',
  params: {
  }, headers: headers

p JSON.parse(result)
1
2
3
4
5
6
7
8
import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/reg', headers = headers)

print(r.json())
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/reg', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
URL obj = new URL("/reg");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/reg", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /reg

search local register

Query the local MetaRex register

Defaults to returning the most recently added entries based on the configuration of limit. Query parameter summary (see definitions for defaults):

  • ‘skip=N’ skips the first N entries of the returned results * ’limit=L’ return only L results. * ‘sort=ASC|DESC,CREATE|MODIFIED|ALPHABETICAL’ sorting. * ‘format=MrxIds|EntriesList’

Parameters

NameInTypeRequiredDescription
skipqueryskipParamSchemafalseNumber of records to skip before returning list.
limitquerylimitValueSchemafalseMaxiumum number of records to return.
sortquerysortParamElementSchemafalseSorting of returned records.

Enumerated Values

ParameterValue
sortASC
sortDESC
sortCREATE
sortMODIFIED
sortALPHABETICAL

Example responses

200 Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
[
  {
    "apiVersion": "v0.5.1",
    "entries": [
      "string"
    ],
    "format": "MrxIds",
    "limit": 20,
    "queryId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "start": 7321,
    "serverInfo": {
      "name": "mrx-reg-server",
      "homePage": "https://metarex.media",
      "supportUrl": "https://github.com/metarex-media/mrx-reg-server/issues",
      "version": "v0.5.1"
    }
  }
]

Responses

StatusMeaningDescriptionSchema
200OKsearch results matching criteriaInline
400Bad Requestbad input parameterNone

Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
anonymous[ EntriesResponseSchema ]falsenone[A list of Entry objects for presentation on a UI]
ยป apiVersionsemVerSchematruenonea valid semantic version as defined by semver.org
ยป entriesanytruenonenone

oneOf

NameTypeRequiredRestrictionsDescription
ยปยป anonymous[string]falsenonenone

xor

NameTypeRequiredRestrictionsDescription
ยปยป anonymous[object]falsenonenone
ยปยปยป mrxIdstringtruenonenone
ยปยปยป namestringtruenonenone

continued

NameTypeRequiredRestrictionsDescription
ยป formatstringtruenoneThe format of the elements of the list
ยป limitintegertruenoneThe value of the limit query param (if specified) or the default value of limit (if unspecified in the query) or the maximum value that can be used in this system if the specified value was too big.
ยป queryIdstring(uuid)truenoneThe id of the query that generated this list
ยป startintegertruenoneThe number of records skipped before returning this list
ยป serverInfoserverInfoSchemafalsenoneinformation about the server providing results
ยปยป namestringfalsenonename of the server software
ยปยป homePagestring(url)falsenonenone
ยปยป supportUrlstring(url)truenonenone
ยปยป versionstringtruenonea valid semantic version for the running server as defined by semver.org

Enumerated Values

PropertyValue
formatMrxIds
formatEntriesList

owner

addRegisterEntryGenID

Code samples

1
2
3
4
5
# You can also use wget
curl -X POST /reg \
  -H 'Content-Type: application/json' \
  -H 'Accept: text/plain' \
  -H 'Authorization: Bearer {access-token}'
1
2
3
4
POST /reg HTTP/1.1

Content-Type: application/json
Accept: text/plain
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const inputBody = '{
  "metarexId": "string",
  "replacedBy": "string",
  "name": "string",
  "description": "string",
  "mediaType": "string",
  "timingIs": "string",
  "treatAs": "string",
  "expires": "string",
  "mrx": {
    "specification": "string",
    "services": [
      {
        "API": "string",
        "method": "string",
        "metarexId": "string",
        "APISchema": "string",
        "output": "string",
        "description": "string",
        "serviceID": "string"
      }
    ],
    "mapping": {
      "convertTypes": true,
      "MissedFieldsKey": "string",
      "mappingDefinitions": {
        "property1": [
          "string"
        ],
        "property2": [
          "string"
        ]
      }
    }
  },
  "extra": {}
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'text/plain',
  'Authorization':'Bearer {access-token}'
};

fetch('/reg',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'text/plain',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.post '/reg',
  params: {
  }, headers: headers

p JSON.parse(result)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'text/plain',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/reg', headers = headers)

print(r.json())
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'text/plain',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','/reg', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
URL obj = new URL("/reg");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"text/plain"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/reg", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /reg

adds an inventory item

gets a new entry to the MetaRex register

Body parameter

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  "metarexId": "string",
  "replacedBy": "string",
  "name": "string",
  "description": "string",
  "mediaType": "string",
  "timingIs": "string",
  "treatAs": "string",
  "expires": "string",
  "mrx": {
    "specification": "string",
    "services": [
      {
        "API": "string",
        "method": "string",
        "metarexId": "string",
        "APISchema": "string",
        "output": "string",
        "description": "string",
        "serviceID": "string"
      }
    ],
    "mapping": {
      "convertTypes": true,
      "MissedFieldsKey": "string",
      "mappingDefinitions": {
        "property1": [
          "string"
        ],
        "property2": [
          "string"
        ]
      }
    }
  },
  "extra": {}
}

Parameters

NameInTypeRequiredDescription
bodybodyMRXDefinitionfalseThe Metarex register definition

Example responses

201 Response

"string"

400 Response

1
2
3
{
  "ErrorMessage": "string"
}

Responses

StatusMeaningDescriptionSchema
201Createditem uploadedstring
400Bad Requesterror posting the entryErrorMessage
401UnauthorizedNo post permissionsErrorMessage
409Conflictinvalid id, register entry already existsErrorMessage

getRegisterEntry

Code samples

1
2
3
# You can also use wget
curl -X GET /reg/{id} \
  -H 'Accept: application/json'
1
2
3
GET /reg/{id} HTTP/1.1

Accept: application/json
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16

const headers = {
  'Accept':'application/json'
};

fetch('/reg/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/reg/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)
1
2
3
4
5
6
7
8
import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/reg/{id}', headers = headers)

print(r.json())
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/reg/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
URL obj = new URL("/reg/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/reg/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /reg/{id}

gets an inventory item

gets a new entry to the MetaRex register

Parameters

NameInTypeRequiredDescription
idpathMrxIdSchematruenone

Example responses

200 Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  "metarexId": "string",
  "replacedBy": "string",
  "name": "string",
  "description": "string",
  "mediaType": "string",
  "timingIs": "string",
  "treatAs": "string",
  "expires": "string",
  "mrx": {
    "specification": "string",
    "services": [
      {
        "API": "string",
        "method": "string",
        "metarexId": "string",
        "APISchema": "string",
        "output": "string",
        "description": "string",
        "serviceID": "string"
      }
    ],
    "mapping": {
      "convertTypes": true,
      "MissedFieldsKey": "string",
      "mappingDefinitions": {
        "property1": [
          "string"
        ],
        "property2": [
          "string"
        ]
      }
    }
  },
  "extra": {}
}

Responses

StatusMeaningDescriptionSchema
200OKitem foundMRXDefinition
400Bad Requestinvalid id, no register entry foundErrorMessage

addRegisterEntry

Code samples

1
2
3
4
5
# You can also use wget
curl -X POST /reg/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: text/plain' \
  -H 'Authorization: Bearer {access-token}'
1
2
3
4
POST /reg/{id} HTTP/1.1

Content-Type: application/json
Accept: text/plain
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const inputBody = '{
  "metarexId": "string",
  "replacedBy": "string",
  "name": "string",
  "description": "string",
  "mediaType": "string",
  "timingIs": "string",
  "treatAs": "string",
  "expires": "string",
  "mrx": {
    "specification": "string",
    "services": [
      {
        "API": "string",
        "method": "string",
        "metarexId": "string",
        "APISchema": "string",
        "output": "string",
        "description": "string",
        "serviceID": "string"
      }
    ],
    "mapping": {
      "convertTypes": true,
      "MissedFieldsKey": "string",
      "mappingDefinitions": {
        "property1": [
          "string"
        ],
        "property2": [
          "string"
        ]
      }
    }
  },
  "extra": {}
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'text/plain',
  'Authorization':'Bearer {access-token}'
};

fetch('/reg/{id}',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'text/plain',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.post '/reg/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'text/plain',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/reg/{id}', headers = headers)

print(r.json())
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'text/plain',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','/reg/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
URL obj = new URL("/reg/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"text/plain"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/reg/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /reg/{id}

adds an inventory item

gets a new entry to the MetaRex register

Body parameter

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  "metarexId": "string",
  "replacedBy": "string",
  "name": "string",
  "description": "string",
  "mediaType": "string",
  "timingIs": "string",
  "treatAs": "string",
  "expires": "string",
  "mrx": {
    "specification": "string",
    "services": [
      {
        "API": "string",
        "method": "string",
        "metarexId": "string",
        "APISchema": "string",
        "output": "string",
        "description": "string",
        "serviceID": "string"
      }
    ],
    "mapping": {
      "convertTypes": true,
      "MissedFieldsKey": "string",
      "mappingDefinitions": {
        "property1": [
          "string"
        ],
        "property2": [
          "string"
        ]
      }
    }
  },
  "extra": {}
}

Parameters

NameInTypeRequiredDescription
idpathMrxIdPostSchematruenone
bodybodyMRXDefinitionfalseThe Metarex register definition

Example responses

201 Response

"string"

400 Response

1
2
3
{
  "ErrorMessage": "string"
}

Responses

StatusMeaningDescriptionSchema
201Createditem uploadedstring
400Bad Requesterror posting the entryErrorMessage
401UnauthorizedNo post permissionsErrorMessage
409Conflictinvalid id, register entry already existsErrorMessage

getRegisterEntryAdmin

Code samples

1
2
3
4
# You can also use wget
curl -X GET /regadmin/reg/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
1
2
3
GET /regadmin/reg/{id} HTTP/1.1

Accept: application/json
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/regadmin/reg/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get '/regadmin/reg/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)
1
2
3
4
5
6
7
8
9
import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/regadmin/reg/{id}', headers = headers)

print(r.json())
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/regadmin/reg/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
URL obj = new URL("/regadmin/reg/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/regadmin/reg/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /regadmin/reg/{id}

gets an inventory item

gets a new entry to the MetaRex register

Parameters

NameInTypeRequiredDescription
idpathMrxIdSchematruenone

Example responses

200 Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  "metarexId": "string",
  "replacedBy": "string",
  "name": "string",
  "description": "string",
  "mediaType": "string",
  "timingIs": "string",
  "treatAs": "string",
  "expires": "string",
  "mrx": {
    "specification": "string",
    "services": [
      {
        "API": "string",
        "method": "string",
        "metarexId": "string",
        "APISchema": "string",
        "output": "string",
        "description": "string",
        "serviceID": "string"
      }
    ],
    "mapping": {
      "convertTypes": true,
      "MissedFieldsKey": "string",
      "mappingDefinitions": {
        "property1": [
          "string"
        ],
        "property2": [
          "string"
        ]
      }
    }
  },
  "extra": {}
}

Responses

StatusMeaningDescriptionSchema
200OKitem foundMRXDefinition
400Bad Requestinvalid id, no register entry foundErrorMessage
401UnauthorizedNo admin permissionsErrorMessage

getHelpRegisterEntryAdmin

Code samples

1
2
3
4
# You can also use wget
curl -X GET /regadmin/reg/{id}/help \
  -H 'Accept: text/markdown' \
  -H 'Authorization: Bearer {access-token}'
1
2
3
GET /regadmin/reg/{id}/help HTTP/1.1

Accept: text/markdown
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17

const headers = {
  'Accept':'text/markdown',
  'Authorization':'Bearer {access-token}'
};

fetch('/regadmin/reg/{id}/help',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/markdown',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get '/regadmin/reg/{id}/help',
  params: {
  }, headers: headers

p JSON.parse(result)
1
2
3
4
5
6
7
8
9
import requests
headers = {
  'Accept': 'text/markdown',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/regadmin/reg/{id}/help', headers = headers)

print(r.json())
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'text/markdown',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/regadmin/reg/{id}/help', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
URL obj = new URL("/regadmin/reg/{id}/help");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"text/markdown"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/regadmin/reg/{id}/help", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /regadmin/reg/{id}/help

gets an inventory item

gets a new entry to the MetaRex register

Parameters

NameInTypeRequiredDescription
idpathMrxIdSchematruenone

Example responses

200 Response

400 Response

1
2
3
{
  "ErrorMessage": "string"
}

Responses

StatusMeaningDescriptionSchema
200OKitem foundMessage
400Bad Requestinvalid id, no register entry foundErrorMessage
401UnauthorizedNo admin permissionsErrorMessage

Schemas

ErrorMessage

1
2
3
{
  "ErrorMessage": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
ErrorMessagestringfalsenonenone

Message

1
2
3
4
{
  "Message": "string",
  "MrxId": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
Messagestringfalsenonenone
MrxIdstringfalsenonenone

MRXDefinition

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  "metarexId": "string",
  "replacedBy": "string",
  "name": "string",
  "description": "string",
  "mediaType": "string",
  "timingIs": "string",
  "treatAs": "string",
  "expires": "string",
  "mrx": {
    "specification": "string",
    "services": [
      {
        "API": "string",
        "method": "string",
        "metarexId": "string",
        "APISchema": "string",
        "output": "string",
        "description": "string",
        "serviceID": "string"
      }
    ],
    "mapping": {
      "convertTypes": true,
      "MissedFieldsKey": "string",
      "mappingDefinitions": {
        "property1": [
          "string"
        ],
        "property2": [
          "string"
        ]
      }
    }
  },
  "extra": {}
}

Properties

NameTypeRequiredRestrictionsDescription
metarexIdMrxIdSchematruenonean MRX generated ID matching the pattern or a uuid type 1
replacedByMrxIdSchemafalsenonea Metarex ID superseding this entry
namestringtruenoneA short human readable UTF-8 name for the metadata payload in the language of its intended use.
descriptionstringtruenoneA short human readable UTF-8 description of the type of metadata with this is ID in the language of its intended use.
mediaTypestringtruenonea valid media type for the unwrapped metadata payload when sent using a POST request to a web service ( https://www.iana.org/assignments/media-types/ )
timingIsstringfalsenoneclocked when there is one document per frame (MXF frame wrapping). embedded when the timing is inside the metadata document
treatAsstringfalsenonetext when the metadata is treated like text (JSON, YAML, XML etc), binary when the document is treated as a blob by some application (machine data, word docs, pdf docs and the like)
expiresstringfalsenoneThe UTC date+time when this entry may be removed from the register. If the property is missing then the entry never expires.
mrxobjectfalsenonemrx controlled properties that enhance the metadata definition
ยป specificationstringfalsenonenone
ยป services[object]falsenonenone
ยปยป APIstringfalsenonenone
ยปยป methodstringfalsenonenone
ยปยป metarexIdstringfalsenonenone
ยปยป APISchemastringfalsenonenone
ยปยป outputstringfalsenonenone
ยปยป descriptionstringfalsenonenone
ยปยป serviceIDstringfalsenonenone
ยป mappingobjectfalsenonenone
ยปยป convertTypesbooleanfalsenonenone
ยปยป MissedFieldsKeystringfalsenonenone
ยปยป mappingDefinitionsobjectfalsenonenone
ยปยปยป additionalProperties[string]falsenonenone
extraobjectfalsenoneregistrant controlled properties that enhance the metadata definition

EntriesArraySchema

1
2
3
[
  "string"
]

Properties

oneOf

NameTypeRequiredRestrictionsDescription
anonymousMrxIdsArraySchemafalsenonenone

xor

NameTypeRequiredRestrictionsDescription
anonymousEntryArraySchemafalsenonenone

EntryArraySchema

1
2
3
4
5
6
[
  {
    "mrxId": "string",
    "name": "string"
  }
]

Properties

NameTypeRequiredRestrictionsDescription
mrxIdstringtruenonenone
namestringtruenonenone

MrxIdsArraySchema

1
2
3
[
  "string"
]

Properties

None

MrxIdSchema

1
"string"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

MrxIdPostSchema

1
"string"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

EntriesResponseSchema

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
  "apiVersion": "v0.5.1",
  "entries": [
    "string"
  ],
  "format": "MrxIds",
  "limit": 20,
  "queryId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "start": 7321,
  "serverInfo": {
    "name": "mrx-reg-server",
    "homePage": "https://metarex.media",
    "supportUrl": "https://github.com/metarex-media/mrx-reg-server/issues",
    "version": "v0.5.1"
  }
}

A list of Entry objects for presentation on a UI

Properties

NameTypeRequiredRestrictionsDescription
apiVersionsemVerSchematruenonea valid semantic version as defined by semver.org
entriesEntriesArraySchematruenonenone
formatstringtruenoneThe format of the elements of the list
limitintegertruenoneThe value of the limit query param (if specified) or the default value of limit (if unspecified in the query) or the maximum value that can be used in this system if the specified value was too big.
queryIdstring(uuid)truenoneThe id of the query that generated this list
startintegertruenoneThe number of records skipped before returning this list
serverInfoserverInfoSchemafalsenoneinformation about the server providing results

Enumerated Values

PropertyValue
formatMrxIds
formatEntriesList

MrxEntryPostSchema

1
null

this API is an implementation of the document specified at https://metarex.media/reg/MXF.123.456.769.abc

Properties

None

serverInfoSchema

1
2
3
4
5
6
{
  "name": "mrx-reg-server",
  "homePage": "https://metarex.media",
  "supportUrl": "https://github.com/metarex-media/mrx-reg-server/issues",
  "version": "v0.5.1"
}

information about the server providing results

Properties

NameTypeRequiredRestrictionsDescription
namestringfalsenonename of the server software
homePagestring(url)falsenonenone
supportUrlstring(url)truenonenone
versionstringtruenonea valid semantic version for the running server as defined by semver.org

limitAllSchema

1
"ALL"

A value of ALL for limit will result in the maximum number of entries allowed by the system (max limit)

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneA value of ALL for limit will result in the maximum number of entries allowed by the system (max limit)

Enumerated Values

PropertyValue
anonymousALL

limitSchema

1
20

Properties

None

limitValueSchema

1
20

A limit can be an integer value indicating the maximum number of entries to return in a query. A limit value set greater than the system’s internal max limit value will be clamped to the max limit value number.

Properties

NameTypeRequiredRestrictionsDescription
anonymousintegerfalsenoneA limit can be an integer value indicating the maximum number of entries to return in a query. A limit value set greater than the system’s internal max limit value will be clamped to the max limit value number.

skipParamSchema

1
0

an integer of the number of items to skip in responses

Properties

NameTypeRequiredRestrictionsDescription
anonymousintegerfalsenonean integer of the number of items to skip in responses

semVerSchema

1
"v0.5.1"

a valid semantic version as defined by semver.org

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonea valid semantic version as defined by semver.org

sortParamSchema

1
"ASC"

A comma separated list of sortParamElementSchema values presented as an array to the server.

Properties

None

sortParamElementSchema

1
"ASC"

Valid keywords are described here - how the logic is applied is application specific. Recommended behaviour is that precedence is highest at the start of the query string and lowest at the end. sort=ASC,MODIFIED,DESC,ALPHABETICAL would result in sorting by ASC first, then MODIFIED. DESC and ALPHABETICAL are ignored because of mutual exclusivity rules.

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneValid keywords are described here - how the logic is applied is application specific. Recommended behaviour is that precedence is highest at the start of the query string and lowest at the end.
sort=ASC,MODIFIED,DESC,ALPHABETICAL
would result in sorting by ASC first, then MODIFIED. DESC and ALPHABETICAL are ignored because of mutual exclusivity rules.

Enumerated Values

PropertyValue
anonymousASC
anonymousDESC
anonymousCREATE
anonymousMODIFIED
anonymousALPHABETICAL