MENU navbar-image

Introduction

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

Authenticating requests

This API is not authenticated.

Buckets

Store a new bucket.

Creates a new bucket with the provided name and user ID.

Example request:
curl --request POST \
    "http://configurationshub.com/api/bucket" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"aut\",
    \"user_id\": 16
}"
const url = new URL(
    "http://configurationshub.com/api/bucket"
);

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

let body = {
    "name": "aut",
    "user_id": 16
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "success": true,
    "data": {
        "id": 1,
        "user_id": 19,
        "name": "New Bucket"
    }
}
 

Example response (409):


{
    "success": false,
    "error": {
        "code": "DUPLICATE_RESOURCE",
        "message": "Resource already exists"
    }
}
 

Example response (422):


{
    "success": false,
    "error": {
        "code": 422,
        "message": "The given data was invalid"
    }
}
 

Example response (500):


{
    "success": false,
    "error": {
        "code": 500,
        "message": "Error creating bucket"
    }
}
 

Request   

POST api/bucket

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

The name of the bucket. Example: aut

user_id   integer   

The ID of the user associated with the bucket. Example: 16

Get a list of buckets.

Retrieves a list of buckets based on optional filtering criteria.

Example request:
curl --request GET \
    --get "http://configurationshub.com/api/buckets?userId=7" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://configurationshub.com/api/buckets"
);

const params = {
    "userId": "7",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "success": true,
    "data": [
        {
            "id": 1,
            "user_id": 15,
            "name": "Bucket 1"
        },
        {
            "id": 2,
            "user_id": 15,
            "name": "Bucket 2"
        }
    ]
}
 

Request   

GET api/buckets

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

userId   integer  optional  

Optional. Filter by user ID. Example: 7

Get a specific bucket.

Retrieves a specific bucket by its ID.

Example request:
curl --request GET \
    --get "http://configurationshub.com/api/bucket/4" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://configurationshub.com/api/bucket/4"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "success": true,
    "data": {
        "id": 1,
        "user_id": 15,
        "name": "Bucket 1"
    }
}
 

Example response (404):


{
    "success": false,
    "error": {
        "code": 404,
        "message": "Bucket not found"
    }
}
 

Request   

GET api/bucket/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the bucket. Example: 4

Exports a specific bucket.

Generates an export file to be downloaded for a specific bucket.

Example request:
curl --request GET \
    --get "http://configurationshub.com/api/bucket/2/export" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://configurationshub.com/api/bucket/2/export"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "success": true,
    "message": "Data exported successfully"
    "link": Llnk-to-file
    }
}
 

Example response (404):


{
    "success": false,
    "error": {
        "code": 404,
        "message": "Bucket not found"
    }
}
 

Request   

GET api/bucket/{id}/export

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the bucket. Example: 2

Update a specific bucket.

Updates the details of a specific bucket.

Example request:
curl --request PUT \
    "http://configurationshub.com/api/bucket/17" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"voluptas\"
}"
const url = new URL(
    "http://configurationshub.com/api/bucket/17"
);

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

let body = {
    "name": "voluptas"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "success": true,
    "bucket": {
        "id": 1,
        "user_id": 15,
        "name": "Updated Bucket"
    }
}
 

Example response (404):


{
    "success": false,
    "error": "Bucket not found"
}
 

Example response (422):


{
    "success": false,
    "error": "Invalid data provided"
}
 

Request   

PUT api/bucket/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the bucket. Example: 17

Body Parameters

name   string   

The new name of the bucket. Example: voluptas

Configs

Store a new config.

Creates a new config entry with the provided name and user ID.

Example request:
curl --request POST \
    "http://configurationshub.com/api/config" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"bucket_id\": 12,
    \"key\": \"pariatur\",
    \"value\": \"in\"
}"
const url = new URL(
    "http://configurationshub.com/api/config"
);

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

let body = {
    "bucket_id": 12,
    "key": "pariatur",
    "value": "in"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "success": true,
    "data": {
        "id": 1,
        "user_id": 19,
        "name": "New Bucket"
    }
}
 

Example response (409):


{
    "success": false,
    "error": {
        "code": "DUPLICATE_RESOURCE",
        "message": "Resource already exists"
    }
}
 

Example response (422):


{
    "success": false,
    "error": {
        "code": 422,
        "message": "The given data was invalid"
    }
}
 

Example response (500):


{
    "success": false,
    "error": {
        "code": 23000,
        "message": "Error creating config"
    }
}
 

Request   

POST api/config

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

bucket_id   integer   

The identificator of the bucket. Example: 12

key   string   

The name of the config. Example: pariatur

value   string   

The content of the config. Example: in

Get a list of configs.

Retrieves a list of configurations based on optional filtering criteria.

Example request:
curl --request GET \
    --get "http://configurationshub.com/api/configs?bucket_id=3&key=ullam" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://configurationshub.com/api/configs"
);

const params = {
    "bucket_id": "3",
    "key": "ullam",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
  "success": true,
  "data": [
    {
      "id": 1,
      "bucket_id": 1
      "key": "some_key",
      "value": "some value"
    }
  ]
}
 

Request   

GET api/configs

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

bucket_id   integer  optional  

Optional. Filter by bucket ID. Example: 3

key   string  optional  

Optional. Filter by specific config name. Example: ullam

Update a specific config.

Updates the value of a specific config.

Example request:
curl --request PUT \
    "http://configurationshub.com/api/config/9" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"value\": \"non\"
}"
const url = new URL(
    "http://configurationshub.com/api/config/9"
);

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

let body = {
    "value": "non"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "success": true,
    "config": {
        "id": 1,
        "user_id": 1,
        "key": "existing_key"
        "value": "new value"
    }
}
 

Example response (404):


{
    "success": false,
    "error": "Config not found"
}
 

Example response (422):


{
    "success": false,
    "error": "Invalid data provided"
}
 

Request   

PUT api/config/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the config. Example: 9

Body Parameters

value   string   

The new value of the config. Example: non

Remove a specific config.

Removes entirely a specific config.

Example request:
curl --request DELETE \
    "http://configurationshub.com/api/config/7" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://configurationshub.com/api/config/7"
);

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

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (204):

Empty response
 

Example response (404):


{
    "success": false,
    "error": "Config not found"
}
 

Request   

DELETE api/config/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the config. Example: 7

Endpoints

Display Swagger API page.

Example request:
curl --request GET \
    --get "http://configurationshub.com/api/documentation" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://configurationshub.com/api/documentation"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>L5 Swagger UI</title>
    <link rel="stylesheet" type="text/css" href="http://configurationshub.com/docs/asset/swagger-ui.css?v=1a3104533e165579a786263992e35a84">
    <link rel="icon" type="image/png" href="http://configurationshub.com/docs/asset/favicon-32x32.png?v=40d4f2c38d1cd854ad463f16373cbcb6" sizes="32x32"/>
    <link rel="icon" type="image/png" href="http://configurationshub.com/docs/asset/favicon-16x16.png?v=f0ae831196d55d8f4115b6c5e8ec5384" sizes="16x16"/>
    <style>
    html
    {
        box-sizing: border-box;
        overflow: -moz-scrollbars-vertical;
        overflow-y: scroll;
    }
    *,
    *:before,
    *:after
    {
        box-sizing: inherit;
    }

    body {
      margin:0;
      background: #fafafa;
    }
    </style>
</head>

<body>
<div id="swagger-ui"></div>

<script src="http://configurationshub.com/docs/asset/swagger-ui-bundle.js?v=4e2fe08f646490a8d542d9fb4e8e8fed"></script>
<script src="http://configurationshub.com/docs/asset/swagger-ui-standalone-preset.js?v=0246971ab6026010ec3f9fc013907e66"></script>
<script>
    window.onload = function() {
        // Build a system
        const ui = SwaggerUIBundle({
            dom_id: '#swagger-ui',
            url: "http://configurationshub.com/docs/api-docs.json",
            operationsSorter: null,
            configUrl: null,
            validatorUrl: null,
            oauth2RedirectUrl: "http://configurationshub.com/api/oauth2-callback",

            requestInterceptor: function(request) {
                request.headers['X-CSRF-TOKEN'] = '';
                return request;
            },

            presets: [
                SwaggerUIBundle.presets.apis,
                SwaggerUIStandalonePreset
            ],

            plugins: [
                SwaggerUIBundle.plugins.DownloadUrl
            ],

            layout: "StandaloneLayout",
            docExpansion : "none",
            deepLinking: true,
            filter: true,
            persistAuthorization: "false",

        })

        window.ui = ui

            }
</script>
</body>
</html>

 

Request   

GET api/documentation

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Display Oauth2 callback pages.

Example request:
curl --request GET \
    --get "http://configurationshub.com/api/oauth2-callback" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://configurationshub.com/api/oauth2-callback"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

Show headers
content-type: text/html; charset=UTF-8
cache-control: no-cache, private
access-control-allow-origin: *
 

<!doctype html>
<html lang="en-US">
<head>
    <title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
    'use strict';
    function run () {
        var oauth2 = window.opener.swaggerUIRedirectOauth2;
        var sentState = oauth2.state;
        var redirectUrl = oauth2.redirectUrl;
        var isValid, qp, arr;

        if (/code|token|error/.test(window.location.hash)) {
            qp = window.location.hash.substring(1).replace('?', '&');
        } else {
            qp = location.search.substring(1);
        }

        arr = qp.split("&");
        arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
        qp = qp ? JSON.parse('{' + arr.join() + '}',
                function (key, value) {
                    return key === "" ? value : decodeURIComponent(value);
                }
        ) : {};

        isValid = qp.state === sentState;

        if ((
          oauth2.auth.schema.get("flow") === "accessCode" ||
          oauth2.auth.schema.get("flow") === "authorizationCode" ||
          oauth2.auth.schema.get("flow") === "authorization_code"
        ) && !oauth2.auth.code) {
            if (!isValid) {
                oauth2.errCb({
                    authId: oauth2.auth.name,
                    source: "auth",
                    level: "warning",
                    message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
                });
            }

            if (qp.code) {
                delete oauth2.state;
                oauth2.auth.code = qp.code;
                oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
            } else {
                let oauthErrorMsg;
                if (qp.error) {
                    oauthErrorMsg = "["+qp.error+"]: " +
                        (qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
                        (qp.error_uri ? "More info: "+qp.error_uri : "");
                }

                oauth2.errCb({
                    authId: oauth2.auth.name,
                    source: "auth",
                    level: "error",
                    message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
                });
            }
        } else {
            oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
        }
        window.close();
    }

    if (document.readyState !== 'loading') {
        run();
    } else {
        document.addEventListener('DOMContentLoaded', function () {
            run();
        });
    }
</script>
</body>
</html>

 

Request   

GET api/oauth2-callback

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

GET api/user

Example request:
curl --request GET \
    --get "http://configurationshub.com/api/user" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://configurationshub.com/api/user"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

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

{
    "error": "Unauthorized"
}
 

Request   

GET api/user

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json