Entity Metadata via API

A guide on how to retrieve Namespace and Entity data via API

Overview

You can retrieve the information about Namespaces and Entities defined in Fynapse using REST API endpoints.

Managing Entities Using REST API

This section covers the steps required to retrieve information about Namespaces and Entities defined in Fynapse using REST API.

Processing Diagram

The diagram below illustrates the flow of API calls when retrieving information about Namespaces and Entities:

EntityMetadataAPI.drawio

Example

This example refers to numbered steps on the diagram above.

Downloading a list of Namespaces

You can download a list of all Namespaces defined in Fynapse (1) using the Get all Namespaces endpoint.

GET
/api/v1/namespaces
1import requests
2
3url = "https://api.fynapse.com/api/v1/namespaces"
4
5headers = {"Authorization": "Bearer <token>"}
6
7response = requests.get(url, headers=headers)
8
9print(response.json())
Response
1{
2 "data": [
3 {
4 "name": "fynapse"
5 },
6 {
7 "name": "custom-namespace"
8 }
9 ]
10}

Downloading a list of Entities in a Namespace

You can download a list of all Entities configured in a given Namespace using the Get the list of Entities in a Namespace endpoint.

GET
/api/v1/namespaces/:namespace/entities
1import requests
2
3url = "https://api.fynapse.com/api/v1/namespaces/namespace/entities"
4
5headers = {"Authorization": "Bearer <token>"}
6
7response = requests.get(url, headers=headers)
8
9print(response.json())
Response
1{
2 "data": [
3 {
4 "name": "journal",
5 "temporalityType": "Transaction",
6 "description": "Journal entity"
7 },
8 {
9 "name": "fxRates",
10 "temporalityType": "Transaction",
11 "description": "FX Rate entity"
12 },
13 {
14 "name": "balance",
15 "temporalityType": "Transaction",
16 "description": "Balance entity"
17 }
18 ]
19}

Downloading an Entity schema

You can retrieve an Entity schema as an object using the Get an Entity schema from the Namespace endpoint. Each Entity comprises of an ordered list of attributes. The attributes define the name, structure, and constraints of an Entity.

For more details about Entity structure, refer to Data Structure Definition.

GET
/api/v1/namespaces/:namespace/entities/:entityName/schema
1import requests
2
3url = "https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema"
4
5headers = {"Authorization": "Bearer <token>"}
6
7response = requests.get(url, headers=headers)
8
9print(response.json())

Below is an example of Journal Entity schema:

Response
1{
2 "name": "JournalInput",
3 "temporalityType": "Transaction",
4 "description": "Journal Input",
5 "primaryKeyAttributeNames": [
6 "originJournalId"
7 ],
8 "attributes": [
9 {
10 "name": "originJournalId",
11 "label": "originJournalId",
12 "mandatory": true
13 },
14 {
15 "name": "lines",
16 "label": "Journal Lines",
17 "type": {
18 "typeName": "ListType",
19 "itemType": {
20 "typeName": "InlineEntityType",
21 "definition": {
22 "name": "JournalInputLine",
23 "temporalityType": "Transaction",
24 "description": "Journal Input Line",
25 "primaryKeyAttributeNames": [
26 "journalLineNo"
27 ],
28 "attributes": [
29 {
30 "name": "originJournalLineId",
31 "label": "originJournalLineId",
32 "mandatory": false,
33 "type": "TEXT"
34 },
35 {
36 "name": "journalLineNo",
37 "label": "Journal Line No",
38 "mandatory": true,
39 "type": "UUID"
40 },
41 {
42 "name": "coreDate",
43 "label": "Core Date",
44 "mandatory": true,
45 "type": "DATE"
46 },
47 {
48 "name": "accountingConfig",
49 "label": "Accounting Config",
50 "mandatory": true,
51 "type": "TEXT"
52 },
53 {
54 "name": "journalType",
55 "label": "Journal Type",
56 "mandatory": true,
57 "type": "TEXT"
58 },
59 {
60 "name": "account",
61 "label": "Account",
62 "mandatory": true,
63 "type": "TEXT"
64 },
65 {
66 "name": "amount",
67 "label": "Trx Amount",
68 "mandatory": true,
69 "type": "DECIMAL"
70 },
71 {
72 "name": "currency",
73 "label": "Trx Currency",
74 "mandatory": true,
75 "type": "TEXT"
76 },
77 {
78 "name": "entity",
79 "label": "Entity",
80 "mandatory": true,
81 "type": "TEXT"
82 },
83 {
84 "name": "product",
85 "label": "Product",
86 "mandatory": true,
87 "type": "TEXT"
88 },
89 {
90 "name": "uuidParam",
91 "label": "uuidParam",
92 "mandatory": false,
93 "type": "UUID"
94 },
95 {
96 "name": "intParam",
97 "label": "intParam",
98 "mandatory": false,
99 "type": "INT"
100 }
101 ]
102 }
103 }
104 },
105 "mandatory": true
106 }
107 ]
108}