Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

REST API: POST database

This method is used to create a new database with the REST API. It uses an HTTP POST request to the following address:

https://api.copernica.com/v3/databases?access_token=xxxx

After a successful call the ID of the created request is returned.

Available parameters

  • name: name of the new database
  • description: optional description of the database
  • archived: optional boolean value to archive the database upon creation

PHP example

The following PHP script demonstrates how to use the API method:

// dependencies
require_once('copernica-rest-api.php');

// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 3);

// data to be sent to the api
$data = array(
    'name'          =>  'my-test-database',
    'description'   =>  'a description of the database'
);

// do the call
$api->post("databases", $data);

// return id of created request if successful

The example above requires the CopernicaRestApi class.

More information