Skip to content

Endpoints

watchtower edited this page Jun 6, 2021 · 1 revision

Created by Alex Ivanov

Those are all endpoints that the firebase exposes as of December 14th, 2020

CirclePay endpoints

Those are all endpoint related to payments and payouts.

Generic endpoints

POST: Create card endpoint - /circlepay/create-card

This is the endpoint used for creating a new card entity. It does verification of the card with circle and then saves the valid data into firestore. It also includes the billing details for the user.

This endpoint requires authentication! Please provide an Authorization header with a valid token when calling it.

Example body:

{
  "keyId": "key1",
  "encryptedData": "a lot of text",
  "billingDetails": {
    "name": "Tester Tester",
    "city": "Metropolis",
    "country": "US",
    "line1": "221B Baker Street",
    "postalCode": "31415PI",
    "district": "TX"
  },
  "expMonth": 11,
  "expYear": 2020
}

Expected responses:

HTTP 200 - Everything was fine. The card was created and saved

HTTP 401 - The authentication failed! Please check if you have provided an authentication header and if the token is valid and not expired

HTTP 422 - The validation failed! You need to check the data provided for errors

HTTP 500 - Unspecified error occurred! Please ping us with the error id


GET: Encryption endpoint - /circlepay/encryption

This is the endpoint for getting the current public encryption key from Circle. It is needed for the app to be able to encrypt the sensitive card data, so we don’t see it

This endpoint requires authentication! Please provide an Authorization header with a valid token when calling it.

Expected body: {}

Expected responses

HTTP 200 - Everything was fine. The encrypition details were retrieved

HTTP 401 - The authentication failed! Please check if you have provided an authentication header and if the token is valid and not expired

HTTP 500 - Unspecified error occurred! Please ping us with the error id


Circle notification endpoint

Those endpoints are work in progress, so please do not use them for now

POST Register notifications endpoint - /circlepay/notifications/register

POST Receive notification endpoint - /circlepay/notifications/ping


Wire endpoints

POST: Create new wire endpoint - /circlepay/wire/create This is the endpoint for creating a new wire bank account for the user. It verifies the provided data with Circle and then creates an entity in the firestore for it.

This endpoint requires authentication! Please provide an Authorization header with a valid token when calling it.

Example body:

{
    "iban": "LT133250013130927180",
    "billingDetails": {
        "city": "Sofia",
        "country": "US",
        "line1": "Suhata reka",
        "postalCode": "1517",
        "name": "Alexander Ivanov"
    },
    "bankAddress": {
        "city": "Sofia",
        "country": "LT",
        "line1": "Suhata reka",
        "district": "Poduyane",
        "postalCode": "1517",
        "name": "Revolut"
    }
}

Expected responses: HTTP 200 - Everything was fine. The wire was created and saved

HTTP 401 - The authentication failed! Please check if you have provided an authentication header and if the token is valid and not expired

HTTP 422 - The validation failed! You need to check the data provided for errors

HTTP 500 - Unspecified error occurred! Please ping us with the error id


Payout endpoints

POST: Create new payout endpoint - /circlepay/payouts/create

This endpoint does not execute the payout. Only creates in the firebase. For the payout to be executed and go through it must have the minimum required approvals!

This is the endpoint for creating a new payout. It saves the data for it and then sends emails for approval from selected approvers in the configuration of the app. For more information go here -> https://github.com/daostack/common-monorepo/wiki/How-to-create-a-payout.

GET: Approve payout endpoint - /circlepay/payouts/approve

Be careful! If you are the last needed approval the payout will be executed!

This is the endpoint for approving an already existing payout. The request can be unauthenticated as it has a token on the query string.


Common endpoints

**POST: Create common endpoint - /common/create ** This is the endpoint for creating a new common.

This endpoint requires authentication! Please provide an Authorization header with a valid token when calling it.

Example body:

{   
    "name": "Common Test",
    "image": "https://llandscapes-10674.kxcdn.com/wp-content/uploads/2019/07/lighting.jpg",
    "action": "to do or not to",
    "byline": "basically im am so im not",
    "description": "hey there, am i descriptive",
    "contributionType": "monthly",
    "contributionAmount": 6500,
    "fundingGoalDeadline": 1000
}

Expected responses: HTTP 200 - Everything was fine. The card was common and saved

HTTP 401 - The authentication failed! Please check if you have provided an authentication header and if the token is valid and not expired

HTTP 422 - The validation failed! You need to check the data provided for errors

HTTP 500 - Unspecified error occurred! Please ping us with the error id


Proposal endpoints

Funding proposal endpoints

POST: Create funding proposal endpoint - /proposals/create/funding

Creates a new proposal of funding type. You must be a member of the common that you are trying to join!

This endpoint requires authentication! Please provide an Authorization header with a valid token when calling it.

Example body:

{
    "commonId": "{{commonId}}",
    "description": "hue hue hue, money",
    "amount": 5000,
    "title": "I need money"
}

Expected responses:

HTTP 200 - Everything was fine. The funding proposal was created and saved

HTTP 401 - The authentication failed! Please check if you have provided an authentication header and if the token is valid and not expired

HTTP 403 - The authentication succeeded, but the request was forbidden. Plese check that you have the right to do the thing!

HTTP 404 - Something was not found. Please make sure that the provided resource exists

HTTP 422 - The validation failed! You need to check the data provided for errors

HTTP 500 - Unspecified error occurred! Please ping us with the error id

Join proposal endpoints

POST: Create join proposal endpoint - /proposals/create/join

Creates a new join request proposal for the common. You must not be a member of that common and also not have any other active join requests!

This endpoint requires authentication! Please provide an Authorization header with a valid token when calling it.

Example body:

{
    "commonId": "{{commonId}}",
    "description": "Let me in baby :D",
    "funding": 500000,
    "cardId": "test-card-id"
}

Expected responses:

HTTP 200 - Everything was fine. The join proposal was created and saved

HTTP 400 - Your request was not valid!

HTTP 401 - The authentication failed! Please check if you have provided an authentication header and if the token is valid and not expired

HTTP 404 - Something was not found. Please make sure that the provided resource exists

HTTP 422 - The validation failed! You need to check the data provided for errors

HTTP 500 - Unspecified error occurred! Please ping us with the error id


Vote endpoints

POST: Create vote for proposal endpoint - /proposals/create/vote

Creates vote for any type of proposal. You can only vote one for proposal and must be a member of the common in which the proposal was created!

This endpoint requires authentication! Please provide an Authorization header with a valid token when calling it.

Example body:

{
    "outcome": "approved",
    "proposalId": "{{proposalId}}"
}

Expected responses: HTTP 200 - Everything was fine. The vote was casted

HTTP 400 - Your request was not valid!

HTTP 401 - The authentication failed! Please check if you have provided an authentication header and if the token is valid and not expired

HTTP 404 - Something was not found. Please make sure that the provided resource exists

HTTP 422 - The validation failed! You need to check the data provided for errors

HTTP 500 - Unspecified error occurred! Please ping us with the error id


Subscription endpoints

Generic endpoints

POST: Cancel subscription endpoint - /subscriptions/cancel

Cancels active user subscription. You must be the owner of that subscription in order for the request to succeed

This endpoint requires authentication! Please provide an Authorization header with a valid token when calling it.

Example query params:

subscriptionId="{{subscriptionId}}"

Expected responses: HTTP 200 - Everything was fine. The subscription was canceled

HTTP 401 - The authentication failed! Please check if you have provided an authentication header and if the token is valid and not expired

HTTP 404 - Something was not found. Please make sure that the provided resource exists

HTTP 500 - Unspecified error occurred! Please ping us with the error id

Clone this wiki locally