Generic Storage API Documentation

The API requires standard Basic Authentication in the HTTP header.

The API supports JSON and XML. When you use GET then you should specify Accept in the HTTP header. If Accept is not specified then default format (JSON) will be used.

The data is hierarchical: application contains one to multiple subjects and subject contains one to multiple data entries. Applications, subjects and data entries are identified by a key and they are case insensitive. Please, use only letters (a-z, A-Z), numbers (0-9) and dash (-) in keys to avoid problems because they are used in URI.

The data may contain basically anything. When you store sensitive data, please encrypt the data before you send it to the service and decrypt the data after you retrieve it from the service.

The service stores values of data entries as string or byte array. When you add or update multiple data entries using StringValue type then values will be stored as string. When you add or update single data entry then content defines how the data will be stored. When the media type starts with 'text/' or content has a character set defined then the content will be stored as string. Otherwise the content will be stored as byte array.

List applications

GET api/genericstorage/apps

Gets all applications.

Example JSON response:
[
    {
        "key":"ZSI",
        "name":"Zendesk - Visma Severa Integration"
    },
    {
        "key":"JSI",
        "name":"JIRA - Visma Severa Integration"
    }
]

Get application

GET api/genericstorage/apps/{application}

Gets an application by its key.

Example JSON response:
{
    "key":"ZSI",
    "name":"Zendesk - Visma Severa Integration"
}

Response will be 404 Not Found when the application does not exist.

Update application

PATCH api/genericstorage/apps/{application}

Updates an application. Updates only the fields which has a value in the request. Can update the key of the application.

Example JSON request content:
{
    "name":"Zendesk - Visma Severa Integration"
}

Response will be 404 Not Found when the application does not exist.

List subjects

GET api/genericstorage/apps/{application}/subjects

Gets subjects of an application.

Response will be 404 Not Found when the application does not exist.

Example JSON response:
[
    {
        "key":"Configuration"
        "name":"Configuration"
    },
    {
        "key":"TransferTimes"
        "name":"Transfer times"
    }
]

Get subject

GET api/genericstorage/apps/{application}/subjects/{subject}

Gets a subject of an application by their keys.

Response will be 404 Not Found when the application or the subject does not exist.

Example JSON response:
{
    "key":"Configuration"
    "name":"Configuration"
}

Update subject

PATCH api/genericstorage/apps/{application}/subjects/{subject}

Updates a subject. Updates only the fields which has a value in the request. Can update the key of the subject.

Example JSON request content:
{
    "name":"Transfer times"
}

Response will be 404 Not Found when the application or the subject does not exist.

Get or search data entries

GET api/genericstorage/apps/{application}/subjects/{subject}/entries GET api/genericstorage/apps/{application}/subjects/{subject}/entries?filter=string GET api/genericstorage/apps/{application}/subjects/{subject}/entries?filter=binary GET api/genericstorage/apps/{application}/subjects/{subject}/entries?value={value}

Gets or searches data enties of application's subject.

Optional filter specifies which type of data will be returned and also what details will be returned.

It is also possible to search entries by string value by using "?value={value}". The search is case insensitive. The search matches the whole value. When you do not include filter then key and media type will be returned (the value will not be returned). If you need the value then you need to search "?filter=string&value={value}". The result will be zero to multiple entries.

Response will be 400 Bad Request when filter is incorrect.

Response will be 404 Not Found when the application or the subject does not exist.

Example JSON response without filter:
[
    {
        "key":"URL",
        "mediaType":"text/plain"
    },
    {
        "key":"Username",
        "mediaType":"text/plain"
    },
    {
        "key":"ApiToken",
        "mediaType":"text/plain"
    },
    {
        "key":"Password",
        "mediaType":"text/plain"
    },
    {
        "key":"Logo",
        "mediaType":"image/jpeg"
    }
]
Example JSON response when filter=string:
[
    {
        "key":"URL",
        "mediaType":"text/plain",
        "value":"https://demo.sample.com/"
    },
    {
        "key":"Username",
        "mediaType":"text/plain",
        "value":"mikko"
    },
    {
        "key":"ApiToken",
        "mediaType":"text/plain",
        "value":"encryptedapikey"
    },
    {
        "key":"Password",
        "mediaType":"text/plain",
        "value":null
    }
]
Example JSON response when filter=binary:
[
    {
        "key":"Logo",
        "mediaType":"image/jpeg"
    }
]

Get specific data entry

GET api/genericstorage/apps/{application}/subjects/{subject}/entries/{key}

Gets data of a data entry. This will override Accept specified in the HTTP header and will return the data as stored in the resource. The Content-Type will be set based on the data.

When application, subject or key does not exist then the response is 404 Not Found.

Add multiple data entries

POST api/genericstorage/apps/{application}/subjects/{subject}/entries

Adds multiple data entries. The values will be stored as string. If the media type is not defined then 'text/plain' will be used.

Example JSON request:
[
    {
        "key":"URL",
        "value":"https://demo.sample.com/"
    },
    {
        "key":"Username",
        "value":"mikko"
    },
    {
        "key":"Password",
        "value":"verylongencryptedpasswordandyourcodeknowshowtoencryptanddecryptit"
    },
    {
        "key":"Settings",
        "value":"<foo>True</foo>",
        "mediaType":"application/xml"
    }
]

Response will be 400 Bad Request when the request does not contain any keys, or when one of the keys already exists.

Will create application and/or subject if they are new.

Add single data entry

POST api/genericstorage/apps/{application}/subjects/{subject}/entries/{key}

Adds a single data entry. Please use correct Content-Type which matches with content. When Content-Type starts with 'text/' or character set has been defined then the content will be stored as string. All other Content-Types will be stored as byte array.

Response will be 400 Bad Request when the key already exists.

Will create application and/or subject if they are new.

Update or add multiple data entries

PUT api/genericstorage/apps/{application}/subjects/{subject}/entries

Updates multiple data entries. When the application, the subject or the data entry does not exist then will perform an add operation. Will create the application and/or the subject if they are new. The values will be stored as string. If the media type is not defined then 'text/plain' will be used.

Example JSON request:
[
    {
        "key":"ApiToken",
        "value":"encryptedapikey"
    },
    {
        "key":"Password",
        "value":null
    },
    {
        "key":"Settings",
        "value":"<foo>True</foo>",
        "mediaType":"application/xml"
    }
]

Response will be 400 Bad Request when the request does not contain any keys.

Update or add single data entry

PUT api/genericstorage/apps/{application}/subjects/{subject}/entries/{key}

Updates or adds a single data entry. When the application, the subject or the data entry does not exist then will perform an add operation. Will create the application and/or the subject if they are new.

Please use correct Content-Type which matches with content. When Content-Type starts with 'text/' or character set has been defined then the content will be stored as string. All other Content-Types will be stored as byte array.

Delete subject

DELETE api/genericstorage/apps/{application}/subjects/{subject}

Deletes the subject. Deletes all data entries of the subject. When the deleted subject was the application's last subject then the application will be deleted too.

Delete single data entry

DELETE api/genericstorage/apps/{application}/subjects/{subject}/entries/{key}

Deletes the key and its data. When the deleted key was the subject's last key then the subject will be deleted too. If the subject was deleted and it was the application's last subject then the application will be deleted too.