MENU navbar-image
bash javascript php python

Introduction

This documentation aims to provide all the information you need to work with our API.

Base URL

https://dumka-backend.herokuapp.com

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve the token by doing User Verification.

Proposals

Vote for a proposal

requires authentication

Example request:
curl --request POST \
    "https://dumka-backend.herokuapp.com/api/v1/proposals/15/vote" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"type\": \"upvote\"
}"
const url = new URL(
    "https://dumka-backend.herokuapp.com/api/v1/proposals/15/vote"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "type": "upvote"
}

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://dumka-backend.herokuapp.com/api/v1/proposals/15/vote',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Accept' => 'application/json',
        ],
        'json' => [
            'type' => 'upvote',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://dumka-backend.herokuapp.com/api/v1/proposals/15/vote'
payload = {
    "type": "upvote"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_KEY}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/proposals/{proposal}/vote

URL Parameters

proposal  integer  

Body Parameters

type  string  

Must be one of upvote or downvote.

Get a list of proposals

requires authentication

Example request:
curl --request GET \
    --get "https://dumka-backend.herokuapp.com/api/v1/schools/12/proposals" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://dumka-backend.herokuapp.com/api/v1/schools/12/proposals"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'https://dumka-backend.herokuapp.com/api/v1/schools/12/proposals',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://dumka-backend.herokuapp.com/api/v1/schools/12/proposals'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_KEY}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/schools/{school}/proposals

URL Parameters

school  integer  

Add a new proposal

requires authentication

Example request:
curl --request POST \
    "https://dumka-backend.herokuapp.com/api/v1/schools/5/proposals" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"title\": \"voluptatem\",
    \"body\": \"explicabo\"
}"
const url = new URL(
    "https://dumka-backend.herokuapp.com/api/v1/schools/5/proposals"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "title": "voluptatem",
    "body": "explicabo"
}

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://dumka-backend.herokuapp.com/api/v1/schools/5/proposals',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Accept' => 'application/json',
        ],
        'json' => [
            'title' => 'voluptatem',
            'body' => 'explicabo',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://dumka-backend.herokuapp.com/api/v1/schools/5/proposals'
payload = {
    "title": "voluptatem",
    "body": "explicabo"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_KEY}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/schools/{school}/proposals

URL Parameters

school  integer  

Body Parameters

title  string  

body  string  

Schools

Get a list of schools

Example request:
curl --request GET \
    --get "https://dumka-backend.herokuapp.com/api/v1/schools" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://dumka-backend.herokuapp.com/api/v1/schools"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'https://dumka-backend.herokuapp.com/api/v1/schools',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://dumka-backend.herokuapp.com/api/v1/schools'
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "data": [
        {
            "id": 1,
            "name": "Alverta Hickle"
        },
        {
            "id": 2,
            "name": "Jane Romaguera"
        },
        {
            "id": 3,
            "name": "Jeffery Deckow"
        },
        {
            "id": 4,
            "name": "Camryn Fay MD"
        },
        {
            "id": 5,
            "name": "Jeremy Reichert DDS"
        },
        {
            "id": 6,
            "name": "Miss Rhoda Mann Sr."
        },
        {
            "id": 7,
            "name": "Sheldon Becker"
        },
        {
            "id": 8,
            "name": "Camden Fadel"
        },
        {
            "id": 9,
            "name": "Gerda Denesik"
        },
        {
            "id": 10,
            "name": "Rhett Schuster DDS"
        }
    ]
}
 

Request      

GET api/v1/schools

Users

Authentication

Makes a new verification code. Will register the account if it doesn't already exist

Example request:
curl --request POST \
    "https://dumka-backend.herokuapp.com/api/v1/schools/12/users/auth" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"accusamus\",
    \"slug\": \"sed\"
}"
const url = new URL(
    "https://dumka-backend.herokuapp.com/api/v1/schools/12/users/auth"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "accusamus",
    "slug": "sed"
}

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://dumka-backend.herokuapp.com/api/v1/schools/12/users/auth',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'accusamus',
            'slug' => 'sed',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://dumka-backend.herokuapp.com/api/v1/schools/12/users/auth'
payload = {
    "name": "accusamus",
    "slug": "sed"
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/schools/{school}/users/auth

URL Parameters

school  integer  

Body Parameters

name  string optional  

slug  string  

Verification

Get user token by passing one-time verification code.

Example request:
curl --request POST \
    "https://dumka-backend.herokuapp.com/api/v1/schools/11/users/verify" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"verification_code\": \"aut\",
    \"slug\": \"perspiciatis\"
}"
const url = new URL(
    "https://dumka-backend.herokuapp.com/api/v1/schools/11/users/verify"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "verification_code": "aut",
    "slug": "perspiciatis"
}

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://dumka-backend.herokuapp.com/api/v1/schools/11/users/verify',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
        'json' => [
            'verification_code' => 'aut',
            'slug' => 'perspiciatis',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://dumka-backend.herokuapp.com/api/v1/schools/11/users/verify'
payload = {
    "verification_code": "aut",
    "slug": "perspiciatis"
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/schools/{school}/users/verify

URL Parameters

school  integer  

Body Parameters

verification_code  string  

slug  string