Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDP-1056] sdp: add SDP Admin API spec #397

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions network/stellar-disbursement-platform/resources/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ Data on the Stellar Disbursement Platform is organized according to resources. E
| [Registration](./registration/README.mdx) | |
| [Statistics](./statistics/README.mdx) | |
| [Users](./users/README.mdx) | |
| [Admin](./admin/README.mdx) | |

</MethodTable>
20 changes: 20 additions & 0 deletions network/stellar-disbursement-platform/resources/admin/README.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Admin
order: 9
---

import {EndpointsTable} from "@site/src/components/EndpointsTable";

The Admin API oversees the management of tenants within the system, facilitating tasks such as provisioning new tenants, updating their information, and retrieving tenant data.

<EndpointsTable title="Endpoints">

| | |
| --- | --------------------- |
| GET | [/tenants](../get-all-tenants.api.mdx) |
| POST | [/tenants](../create-tenant.api.mdx) |
| GET | [/tenants/:arg](../retrieve-a-tenant.api.mdx) |
| PATCH | [/tenants/:id](../update-a-tenant.api.mdx) |


</EndpointsTable>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
id: create-tenant
title: "Create Tenant"
description: "Create Tenant"
sidebar_label: "Create Tenant"
hide_title: true
hide_table_of_contents: true
api: {"responses":{"201":{"description":"Provision a new tenant","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","example":"1736bed3-7b92-4760-8ff2-51fb08ee079f"},"name":{"type":"string","example":"bluecorp","description":"The tenant name. It should match the pattern `^[a-z-]+$`."},"email_sender_type":{"type":"string","enum":["DRY_RUN","AWS_EMAIL"],"description":"The e-mail sender provider."},"sms_sender_type":{"type":"string","enum":["DRY_RUN","AWS_SMS","TWILIO_SMS"],"description":"The SMS sender provider."},"base_url":{"type":"string","example":"https://bluecorp-backend.sdp.org","description":"The SDP backend server's base URL."},"sdp_ui_base_url":{"type":"string","example":"https://bluecorp.sdp.org","description":"The SDP UI/dashboard Base URL."},"status":{"type":"string","enum":["TENANT_CREATED","TENANT_PROVISIONED","TENANT_ACTIVATED","TENANT_DEACTIVATED"]},"distribution_account":{"type":"string","example":"GCXAJ3XJ3VK3JFH3QMDFOSKM2NMMZBSO3VIT6EUPQWSDW2J74M23RRSL"},"created_at":{"type":"string","format":"date-time","example":"2024-03-27T17:21:51.000Z"},"updated_at":{"type":"string","format":"date-time","example":"2024-03-27T17:21:51.000Z"}},"required":["id","name","email_sender_type","sms_sender_type","status","created_at","updated_at"],"example":{"id":"840dca45-d1df-44cd-83c1-65c04235c25f","name":"redcorp","email_sender_type":"DRY_RUN","sms_sender_type":"DRY_RUN","base_url":"https://redcorp-backend.sdp.org","sdp_ui_base_url":"https://redcorp.sdp.org","status":"TENANT_PROVISIONED","distribution_account":"GCQVDMPOEN3HHJJ64V42KUTONOXN7C6V2PSVPALEVJ7PIYOB6M3DJV7N","created_at":"2024-03-27T17:21:51.000Z","updated_at":"2024-03-27T17:21:51.000Z"}}}}},"401":{"description":"Unauthorized","headers":{},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"extras":{"type":"object","properties":{"status":{"type":"number"},"message":{"type":"string"}}}},"example":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}},"examples":{"response":{"value":{"error":"Not authorized","extras":{"status":401,"message":"Not authorized"}}}}}}}},"operationId":"Create Tenant","tags":["Admin"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The tenant name. It should match the pattern `^[a-z-]+$`"},"owner_email":{"type":"string","description":"The owner user e-mail address"},"owner_first_name":{"type":"string","description":"The owner user first name"},"owner_last_name":{"type":"string","description":"The owner user last name"},"organization_name":{"type":"string","description":"The organization name"},"email_sender_type":{"type":"string","enum":["DRY_RUN","AWS_EMAIL"],"description":"The e-mail sender provider."},"sms_sender_type":{"type":"string","enum":["DRY_RUN","AWS_SMS","TWILIO_SMS"],"description":"The SMS sender provider."},"base_url":{"type":"string","description":"The SDP backend server's base URL."},"sdp_ui_base_url":{"type":"string","description":"The SDP UI/dashboard Base URL."},"distribution_account":{"type":"string"}},"example":{"name":"redcorp","owner_email":"[email protected]","owner_first_name":"Owner","owner_last_name":"Last","organization_name":"Red Corp","email_sender_type":"DRY_RUN","sms_sender_type":"DRY_RUN","base_url":"https://redcorp-backend.sdp.org","sdp_ui_base_url":"https://redcorp.sdp.org","distribution_account":"GCQVDMPOEN3HHJJ64V42KUTONOXN7C6V2PSVPALEVJ7PIYOB6M3DJV7N"},"required":["name","owner_email","owner_first_name","owner_last_name","organization_name","email_sender_type","sms_sender_type","base_url","sdp_ui_base_url","distribution_account"]}}}},"security":[{"BasicAuth":[]}],"description":"Create Tenant","method":"post","path":"/tenants","securitySchemes":{"BearerAuth":{"type":"apiKey","name":"Authorization","in":"header","description":"JWT used for authentication, signed with an ES256 private key."},"BasicAuth":{"type":"http","scheme":"basic"}},"jsonRequestBodyExample":{"name":"redcorp","owner_email":"[email protected]","owner_first_name":"Owner","owner_last_name":"Last","organization_name":"Red Corp","email_sender_type":"DRY_RUN","sms_sender_type":"DRY_RUN","base_url":"https://redcorp-backend.sdp.org","sdp_ui_base_url":"https://redcorp.sdp.org","distribution_account":"GCQVDMPOEN3HHJJ64V42KUTONOXN7C6V2PSVPALEVJ7PIYOB6M3DJV7N"},"info":{"title":"Stellar Disbursement Platform API","version":"","description":"The Stellar Disbursement Platform (SDP) is a tool built for organizations to make bulk payments to a group of recipients over the Stellar network. You can read more about using the SDP [here](https://developers.stellar.org/docs/category/use-the-stellar-disbursement-platform)."},"postman":{"name":"Create Tenant","description":{"type":"text/plain"},"url":{"path":["tenants"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}},"auth":{"type":"basic","basic":[{"type":"any","value":"<Basic Auth Username>","key":"username"},{"type":"any","value":"<Basic Auth Password>","key":"password"}]}}}
sidebar_class_name: "post api-method"
info_path: network/stellar-disbursement-platform/resources/stellar-disbursement-platform-api
custom_edit_url: null
---

import { SepBadge } from "@site/src/components/SepBadge";

<SepBadge tags={"Admin"}/>

import ApiTabs from "@theme/ApiTabs";
import MimeTabs from "@theme/MimeTabs";
import ParamsItem from "@theme/ParamsItem";
import ResponseSamples from "@theme/ResponseSamples";
import SchemaItem from "@theme/SchemaItem";
import SchemaTabs from "@theme/SchemaTabs";
import DiscriminatorTabs from "@theme/DiscriminatorTabs";
import TabItem from "@theme/TabItem";

## Create Tenant



Create Tenant

<MimeTabs><TabItem label={"application/json"} value={"application/json-schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Request Body</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The tenant name. It should match the pattern `^[a-z-]+$`"}}></SchemaItem><SchemaItem collapsible={false} name={"owner_email"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The owner user e-mail address"}}></SchemaItem><SchemaItem collapsible={false} name={"owner_first_name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The owner user first name"}}></SchemaItem><SchemaItem collapsible={false} name={"owner_last_name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The owner user last name"}}></SchemaItem><SchemaItem collapsible={false} name={"organization_name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The organization name"}}></SchemaItem><SchemaItem collapsible={false} name={"email_sender_type"} required={true} schemaName={"string"} qualifierMessage={"**Possible values:** [`DRY_RUN`, `AWS_EMAIL`]"} schema={{"type":"string","enum":["DRY_RUN","AWS_EMAIL"],"description":"The e-mail sender provider."}}></SchemaItem><SchemaItem collapsible={false} name={"sms_sender_type"} required={true} schemaName={"string"} qualifierMessage={"**Possible values:** [`DRY_RUN`, `AWS_SMS`, `TWILIO_SMS`]"} schema={{"type":"string","enum":["DRY_RUN","AWS_SMS","TWILIO_SMS"],"description":"The SMS sender provider."}}></SchemaItem><SchemaItem collapsible={false} name={"base_url"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The SDP backend server's base URL."}}></SchemaItem><SchemaItem collapsible={false} name={"sdp_ui_base_url"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The SDP UI/dashboard Base URL."}}></SchemaItem><SchemaItem collapsible={false} name={"distribution_account"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string"}}></SchemaItem></ul></details></TabItem></MimeTabs><div><ApiTabs><TabItem label={"201"} value={"201"}><div>

Provision a new tenant

</div><div><MimeTabs schemaType={"response"}><TabItem label={"application/json"} value={"application/json"}><SchemaTabs><TabItem label={"Schema"} value={"Schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Schema</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"id"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","example":"1736bed3-7b92-4760-8ff2-51fb08ee079f"}}></SchemaItem><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","example":"bluecorp","description":"The tenant name. It should match the pattern `^[a-z-]+$`."}}></SchemaItem><SchemaItem collapsible={false} name={"email_sender_type"} required={true} schemaName={"string"} qualifierMessage={"**Possible values:** [`DRY_RUN`, `AWS_EMAIL`]"} schema={{"type":"string","enum":["DRY_RUN","AWS_EMAIL"],"description":"The e-mail sender provider."}}></SchemaItem><SchemaItem collapsible={false} name={"sms_sender_type"} required={true} schemaName={"string"} qualifierMessage={"**Possible values:** [`DRY_RUN`, `AWS_SMS`, `TWILIO_SMS`]"} schema={{"type":"string","enum":["DRY_RUN","AWS_SMS","TWILIO_SMS"],"description":"The SMS sender provider."}}></SchemaItem><SchemaItem collapsible={false} name={"base_url"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","example":"https://bluecorp-backend.sdp.org","description":"The SDP backend server's base URL."}}></SchemaItem><SchemaItem collapsible={false} name={"sdp_ui_base_url"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","example":"https://bluecorp.sdp.org","description":"The SDP UI/dashboard Base URL."}}></SchemaItem><SchemaItem collapsible={false} name={"status"} required={true} schemaName={"string"} qualifierMessage={"**Possible values:** [`TENANT_CREATED`, `TENANT_PROVISIONED`, `TENANT_ACTIVATED`, `TENANT_DEACTIVATED`]"} schema={{"type":"string","enum":["TENANT_CREATED","TENANT_PROVISIONED","TENANT_ACTIVATED","TENANT_DEACTIVATED"]}}></SchemaItem><SchemaItem collapsible={false} name={"distribution_account"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","example":"GCXAJ3XJ3VK3JFH3QMDFOSKM2NMMZBSO3VIT6EUPQWSDW2J74M23RRSL"}}></SchemaItem><SchemaItem collapsible={false} name={"created_at"} required={true} schemaName={"date-time"} qualifierMessage={undefined} schema={{"type":"string","format":"date-time","example":"2024-03-27T17:21:51.000Z"}}></SchemaItem><SchemaItem collapsible={false} name={"updated_at"} required={true} schemaName={"date-time"} qualifierMessage={undefined} schema={{"type":"string","format":"date-time","example":"2024-03-27T17:21:51.000Z"}}></SchemaItem></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n \"id\": \"840dca45-d1df-44cd-83c1-65c04235c25f\",\n \"name\": \"redcorp\",\n \"email_sender_type\": \"DRY_RUN\",\n \"sms_sender_type\": \"DRY_RUN\",\n \"base_url\": \"https://redcorp-backend.sdp.org\",\n \"sdp_ui_base_url\": \"https://redcorp.sdp.org\",\n \"status\": \"TENANT_PROVISIONED\",\n \"distribution_account\": \"GCQVDMPOEN3HHJJ64V42KUTONOXN7C6V2PSVPALEVJ7PIYOB6M3DJV7N\",\n \"created_at\": \"2024-03-27T17:21:51.000Z\",\n \"updated_at\": \"2024-03-27T17:21:51.000Z\"\n}"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem><TabItem label={"401"} value={"401"}><div>

Unauthorized

</div><details style={{"textAlign":"left","marginBottom":"1rem"}} data-collaposed={true} open={false}><summary style={{}}><strong>Response Headers</strong></summary><ul style={{"marginLeft":"1rem"}}></ul></details><div><MimeTabs schemaType={"response"}><TabItem label={"application/json"} value={"application/json"}><SchemaTabs><TabItem label={"Schema"} value={"Schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Schema</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"error"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string"}}></SchemaItem><SchemaItem collapsible={true} className={"schemaItem"}><details style={{}}><summary style={{}}><strong>extras</strong><span style={{"opacity":"0.6"}}> object</span></summary><div style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"status"} required={false} schemaName={"number"} qualifierMessage={undefined} schema={{"type":"number"}}></SchemaItem><SchemaItem collapsible={false} name={"message"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string"}}></SchemaItem></div></details></SchemaItem></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n \"error\": \"Not authorized\",\n \"extras\": {\n \"status\": 401,\n \"message\": \"Not authorized\"\n }\n}"} language={"json"}></ResponseSamples></TabItem><TabItem label={"response"} value={"response"}><ResponseSamples responseExample={"{\n \"error\": \"Not authorized\",\n \"extras\": {\n \"status\": 401,\n \"message\": \"Not authorized\"\n }\n}"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem></ApiTabs></div>
Loading