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
1curl https://api.fynapse.com/api/v1/namespaces \
2 -H "Authorization: Bearer <token>"
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
1curl https://api.fynapse.com/api/v1/namespaces/namespace/entities \
2 -H "Authorization: Bearer <token>"
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
1curl https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema \
2 -H "Authorization: Bearer <token>"

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