Skip to content

Latest commit

 

History

History
531 lines (404 loc) · 14.6 KB

API.md

File metadata and controls

531 lines (404 loc) · 14.6 KB

Mycelial API

Pipeline Specification (workflows)

POST /api/pipe Creates a pipe config

Headers

name type data type description
Authorization required string Base64 encoded token

Parameters

name type data type description
None required object/payload (JSON) N/A

Payloads

Mycelite Source
{
  "configs": [
    {
      "workspace_id": 1, // this field is currently optional and will default to 1, but may be required in the future.
      "pipe": [
        {
          "name": "sqlite_physical_replication_source",
          "label": "sqlite_physical_replication_source node",
          "client": "{client name}",
          "type": "sqlite_physical_replication",
          "display_name": "{display name}",
          "journal_path": "{path and filename of source journal"
        },
        {
          "name": "mycelial_server_destination",
          "label": "mycelial_server node",
          "type": "mycelial_server",
          "display_name": "Mycelial Server",
          "endpoint": "http://{host or ip}:7777/ingestion",
          "token": "{security token}",
          "topic": "{unique topic id}"
        }
      ]
    }
  ]
}
Mycelite Destination
{
  "configs": [
    {
      "workspace_id": 1, // this field is currently optional and will default to 1, but may be required in the future.
      "pipe": [
        {
          "name": "mycelial_server_source",
          "label": "mycelial_server node",
          "type": "mycelial_server",
          "display_name": "Mycelial Server",
          "endpoint": "http://{host or ip}:7777/ingestion",
          "token": "token",
          "topic": "{topic id}"
        },
        {
          "name": "sqlite_physical_replication_destination",
          "label": "sqlite_physical_replication_destination node",
          "client": "dev",
          "type": "sqlite_physical_replication",
          "display_name": "{display name}",
          "journal_path": "{path and filename of destination journal}",
          "database_path": "{path and filename of destination database"
        }
      ]
    }
  ]
}

Responses

http code content-type response
200 application/json Configuration created successfully
400 text/plain;charset=UTF-8

Example cURL

 curl -X POST 'http://{server}:7777/api/pipe' -H 'Authorization: Basic {base 64 token:}' --data @post.json'
PUT /api/pipe/{id} Updates a pipe config

Headers

name type data type description
Authorization required string Base64 encoded token

Parameters

name type data type description
None required object/payload (JSON) N/A

Payloads

Mycelite Source
{
  "configs": [
    {
      "workspace_id": 1, // this field is currently optional and will default to 1 if not provided, but may be required in the future.
      "pipe": [
        {
          "name": "sqlite_physical_replication_source",
          "label": "sqlite_physical_replication_source node",
          "client": "{client name}",
          "type": "sqlite_physical_replication",
          "display_name": "{display name}",
          "journal_path": "{path and filename of source journal"
        },
        {
          "name": "mycelial_server_destination",
          "label": "mycelial_server node",
          "type": "mycelial_server",
          "display_name": "Mycelial Server",
          "endpoint": "http://{host or ip}:7777/ingestion",
          "token": "{security token}",
          "topic": "{unique topic id}"
        }
      ]
    }
  ]
}
Mycelite Destination
{
  "configs": [
    {
      "workspace_id": 1, // this field is currently optional and will default to 1 if not provided, but may be required in the future.
      "pipe": [
        {
          "name": "mycelial_server_source",
          "label": "mycelial_server node",
          "type": "mycelial_server",
          "display_name": "Mycelial Server",
          "endpoint": "http://{host or ip}:7777/ingestion",
          "token": "token",
          "topic": "{topic id}"
        },
        {
          "name": "sqlite_physical_replication_destination",
          "label": "sqlite_physical_replication_destination node",
          "client": "dev",
          "type": "sqlite_physical_replication",
          "display_name": "{display name}",
          "journal_path": "{path and filename of destination journal}",
          "database_path": "{path and filename of destination database"
        }
      ]
    }
  ]
}

Responses

http code content-type response
200 application/json Configuration created successfully
400 text/plain;charset=UTF-8

Example cURL

 curl -X POST 'http://{server}:7777/api/pipe/1' -H 'Authorization: Basic {base 64 token:}' --data @post.json'
DELETE /api/pipe/{id} Delete a config

Parameters

None

Responses

http code content-type response
200 text/plain;charset=UTF-8
Example cURL
 curl 'http://localhost:7777/api/pipe/{id}' -X 'DELETE' -H 'Authorization: Basic {base 64 token:}' \
GET /api/pipe/{id} fetch a single pipeline specification by id
Parameters

None

Responses
http code content-type response
200 application/json active configurations
Example cURL
 curl 'http://{server}:7777/api/pipe/{id}' -H 'Authorization: Basic {base 64 token:}'
GET /api/pipe (fetch all active pipeline specifications)
Parameters

None

Responses
http code content-type response
200 application/json active configurations
Example cURL
 curl 'http://{server}:7777/api/pipe' -H 'Authorization: Basic {base 64 token:}'

Clients

GET /api/clients List of registered clients

Headers

name type data type description
Authorization required string Base64 encoded token

Parameters

None

Responses

http code content-type response
200 application/json JSON
Response Example
{
    "clients": [
        {
            "id": "dev_client",
            "display_name": "Client 1",
            "sources": [
                {
                    "type": "sqlite_physical_replication",
                    "display_name": "Mycelite SRC",
                    "journal_path": "/Users/knowthen/junk/source.db-mycelial"
                }
            ],
            "destinations": [
                {
                    "type": "sqlite_physical_replication",
                    "display_name": "Mycelite DEST",
                    "journal_path": "/Users/knowthen/junk/dest/destination.db-mycelial",
                    "database_path": "/Users/knowthen/junk/dest/destination.db"
                },
            ]
        },
        {
            "id": "ui",
            "display_name": "UI",
            "sources": [],
            "destinations": []
        }
    ]
}

Example cURL

 curl 'http://{server}:7777/api/clients' -H 'Authorization: Basic {base 64 token:}'

Workspaces

GET /api/workspaces Fetches all workspaces (not hydrated with pipe configs)

Headers

name type data type description
Authorization required string Base64 encoded token

Parameters

None

Responses

http code content-type response
200 application/json Configuration created successfully
400 text/plain;charset=UTF-8
[
  {
    "id": 1,
    "created_at": "2023-10-30T19:46:53.429132Z",
    "pipe_configs": [],
    "name": "Default"
  }
]

Example cURL

 curl 'http://{server}:7777/api/workspaces' -H 'Authorization: Basic {base 64 token:}'
GET /api/workspaces/{id} Fetches a single workspace by id that is hydrated with pipe configs

Headers

name type data type description
Authorization required string Base64 encoded token

Parameters

None

Responses

http code content-type response
200 application/json Configuration created successfully
400 text/plain;charset=UTF-8
{
  "id": 1,
  "created_at": "2023-10-30T19:55:13.646818Z",
  "pipe_configs": [
    {
      "id": 18,
      "pipe": [
        {
          "client": "dev",
          "display_name": "Excel Source",
          "journal_path": "/tmp/test.xlsx",
          "label": "excel_connector_source node",
          "name": "excel_connector_source",
          "path": "/tmp/test.xlsx",
          "sheets": "Sheet1",
          "type": "excel_connector"
        },
        {
          "client": "dev",
          "display_name": "Hello World Dest",
          "label": "hello_world_destination node",
          "name": "hello_world_destination",
          "type": "hello_world"
        }
      ],
      "workspace_id": 1
    }
  ],
  "name": "Default"
}

Example cURL

 curl 'http://{server}:7777/api/workspaces/1' -H 'Authorization: Basic {base 64 token:}'
POST /api/workspaces Creates a workspace

Headers

name type data type description
Authorization required string Base64 encoded token

Parameters

name type data type description
None required object/payload (JSON) N/A

Responses

http code content-type response
200 application/json Configuration created successfully
400 text/plain;charset=UTF-8

Example cURL

 curl -X POST 'http://{server}:7777/api/workspaces/1' -H 'Authorization: Basic {base 64 token:}' --data-raw $'{"name":"new"}'
{"id":1,"created_at":"1970-01-01T00:00:00Z","pipe_configs":[],"name":"new"}
PUT /api/workspaces/{id} Update a workspace

Headers

name type data type description
Authorization required string Base64 encoded token

Parameters

name type data type description
None required object/payload (JSON) N/A

Responses

http code content-type response
200 application/json Configuration created successfully
400 text/plain;charset=UTF-8

Example cURL

 curl -X PUT 'http://{server}:7777/api/workspaces/1' -H 'Authorization: Basic {base 64 token:}' --data-raw $'{"name":"rename"}'
{"id":1,"created_at":"1970-01-01T00:00:00Z","pipe_configs":[],"name":"rename"}
DELETE /api/workspaces/{id} Delete a workspace

Headers

name type data type description
Authorization required string Base64 encoded token

Parameters

None

Responses

http code content-type response
200 application/json Configuration created successfully
400 text/plain;charset=UTF-8

Example cURL

 curl -X DELETE 'http://{server}:7777/api/workspaces/1' -H 'Authorization: Basic {base 64 token:}''