Skip to main content

Database API

All URIs are relative to http://localhost:1000

MethodHTTP requestDescription
databaseExportGET /database/exportYour GET endpoint
databaseImportPOST /database/import/database/import [POST]

databaseExport​

ExportedDatabase databaseExport()

This is going to export your current database.

Example​

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.DatabaseApi(configuration)

apiInstance.databaseExport().then((data: ExportedDatabase) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters​

This endpoint does not need any parameters.

Return type​

ExportedDatabase

HTTP request headers​

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details​

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

databaseImport​

databaseImport()

This is going to take in a database, and merge it with the current database. This will revert your database back to it original form if this request fails.

Example​

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.DatabaseApi(configuration)

const body: Pieces.DatabaseImportRequest = {
// ExportedDatabase | (optional)
exportedDatabase: ,
};

apiInstance.databaseImport(body).then((data: void (empty response body)) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters​

NameTypeDescriptionNotes
exportedDatabaseExportedDatabase

Return type​

void (empty response body)

HTTP request headers​

  • Content-Type: application/json
  • Accept: text/plain

HTTP response details​

Status codeDescriptionResponse headers
204No Content-
500Internal Server Error-
505HTTP Version Not Supported, This means that your user need to update their local os, and they cannot create a shareable link.-