IONOS DBaaS MongoDB REST API (1.0.0)

Download OpenAPI specification:Download

With IONOS Cloud Database as a Service, you have the ability to quickly set up and manage a MongoDB database. You can also delete clusters, manage backups and users via the API.

MongoDB is an open source, cross-platform, document-oriented database program. Classified as a NoSQL database program, it uses JSON-like documents with optional schemas.

The MongoDB API allows you to create additional database clusters or modify existing ones. Both tools, the Data Center Designer (DCD) and the API use the same concepts consistently and are well suited for smooth and intuitive use.

Clusters

A cluster in this context describes a grouping of multiple MongoDB instances into a replica set or sharded cluster.

Get Clusters

Retrieves a list of MongoDB clusters.

Authorizations:
basicAuthtokenAuth
query Parameters
limit
integer [ 1 .. 1000 ]
Default: 100
Example: limit=100

The maximum number of elements to return. Use together with 'offset' for pagination.

offset
integer
Default: 0
Example: offset=200

The first element to return. Use together with 'limit' for pagination.

filter.name
string

Response filter to list only the MongoDB clusters that contain the specified name. The value is case insensitive and matched on the 'displayName' field.

Responses

Response samples

Content type
application/json
{
  • "type": "collection",
  • "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  • "items": [
    ],
  • "offset": 200,
  • "limit": 100,
  • "links": {
    }
}

Create a Cluster

Creates a new MongoDB cluster.

Authorizations:
basicAuthtokenAuth
Request Body schema: application/json

The cluster to be created.

object (Metadata)

The metadata of the resource.

object (CreateClusterProperties)

The properties with all data needed to create a new MongoDB cluster.

Responses

Request samples

Content type
application/json
{
  • "metadata": {
    },
  • "properties": {
    }
}

Response samples

Content type
application/json
{
  • "type": "cluster",
  • "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  • "metadata": {
    },
  • "properties": {
    }
}

Get a cluster by id

Get a cluster by id.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

Responses

Response samples

Content type
application/json
{
  • "type": "cluster",
  • "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  • "metadata": {
    },
  • "properties": {
    }
}

Patch a cluster

Patch attributes of a MongoDB cluster.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

Request Body schema: application/json

Part of the cluster which should be modified.

object (Metadata)

The metadata of the resource.

object (PatchClusterProperties)

Properties of the payload to change a cluster.

Responses

Request samples

Content type
application/json
{
  • "metadata": {
    },
  • "properties": {
    }
}

Response samples

Content type
application/json
{
  • "type": "cluster",
  • "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  • "metadata": {
    },
  • "properties": {
    }
}

Delete a Cluster

Deletes a MongoDB cluster.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

Responses

Response samples

Content type
application/json
{
  • "type": "cluster",
  • "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  • "metadata": {
    },
  • "properties": {
    }
}

Metadata

Metadata about the API, such as versions.

Get API Version

Retrieves the current version of the responding API.

Authorizations:
basicAuthtokenAuth

Responses

Response samples

Content type
application/json

Get All API Versions

Retrieves all available versions of the responding API.

Authorizations:
basicAuthtokenAuth

Responses

Response samples

Content type
application/json

Users

Get all Cluster Users

Retrieves a list of MongoDB users.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

query Parameters
limit
integer [ 1 .. 1000 ]
Default: 100
Example: limit=100

The maximum number of elements to return. Use together with 'offset' for pagination.

offset
integer
Default: 0
Example: offset=200

The first element to return. Use together with 'limit' for pagination.

Responses

Response samples

Content type
application/json
{
  • "type": "collection",
  • "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  • "items": [
    ]
}

Create MongoDB User

Creates a MongoDB user.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

Request Body schema: application/json

The user to be created.

type
string
Enum: "collection" "cluster" "user" "snapshot" "template"

The resource type.

object (UserMetadata)

The metadata of the resource.

object (UserProperties)

Mongodb user properties.

Responses

Request samples

Content type
application/json
{
  • "type": "user",
  • "metadata": {
    },
  • "properties": {
    }
}

Response samples

Content type
application/json
{
  • "type": "user",
  • "metadata": {
    },
  • "properties": {
    }
}

Get a MongoDB User by ID

Retrieves the MongoDB user identified by the username.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

username
required
string

The authentication username.

Responses

Response samples

Content type
application/json
{
  • "type": "user",
  • "metadata": {
    },
  • "properties": {
    }
}

Patch a MongoDB User by ID

Patches a MongoDB user specified by its ID.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

username
required
string

The authentication username.

Request Body schema: application/json

Part of the MongoDB user which should be modified.

object (UserMetadata)

The metadata of the resource.

object (PatchUserProperties)

MongoDB database user patch request properties.

Responses

Request samples

Content type
application/json
{
  • "metadata": {
    },
  • "properties": {
    }
}

Response samples

Content type
application/json
{
  • "type": "user",
  • "metadata": {
    },
  • "properties": {
    }
}

Delete a MongoDB User by ID

Deletes a MongoDB user specified by its ID.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

username
required
string

The authentication username.

Responses

Response samples

Content type
application/json
{
  • "type": "user",
  • "metadata": {
    },
  • "properties": {
    }
}

Logs

Get logs of your cluster

Retrieves MongoDB logs based on the given parameters.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

query Parameters
start
string <date-time>

The start time for the query in RFC3339 format. Must not be more than 30 days ago but before the end parameter. The default is 30 days ago.

end
string <date-time>

The end time for the query in RFC3339 format. Must not be greater than now. The default is the current timestamp.

direction
string
Default: "BACKWARD"
Enum: "BACKWARD" "FORWARD"

The direction in which to scan through the logs. The logs are returned in order of the direction.

limit
integer [ 1 .. 5000 ]
Default: 100

The maximal number of log lines to return. If the limit is reached then log lines will be cut at the end (respecting the scan direction).

Responses

Response samples

Content type
application/json
{
  • "instances": [
    ]
}

Snapshots

Get the snapshots of your cluster

Retrieves MongoDB snapshots.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

query Parameters
limit
integer [ 1 .. 1000 ]
Default: 100
Example: limit=100

The maximum number of elements to return. Use together with 'offset' for pagination.

offset
integer
Default: 0
Example: offset=200

The first element to return. Use together with 'limit' for pagination.

Responses

Response samples

Content type
application/json
{
  • "type": "collection",
  • "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  • "items": [
    ],
  • "offset": 200,
  • "limit": 100,
  • "links": {
    }
}

Restores

In-place restore of a cluster

Triggers an in-place restore of the given MongoDB cluster.

Authorizations:
basicAuthtokenAuth
path Parameters
clusterId
required
string

The unique ID of the cluster.

Request Body schema: application/json

The restore request to create.

snapshotId
string

The unique ID of the snapshot you want to restore.

recoveryTargetTime
string <date-time>

If this value is supplied as ISO 8601 timestamp, the backup will be replayed up until the given timestamp.

Responses

Request samples

Content type
application/json
{
  • "snapshotId": "dcd31531-3ac8-11eb-9feb-046c59cc737e",
  • "recoveryTargetTime": "2023-04-21T13:37:50+01:00"
}

Response samples

Content type
application/json
{
  • "httpStatus": 400,
  • "messages": [
    ]
}

Templates

Get Templates

Retrieves a list of valid templates. These templates can be used to create MongoDB clusters; they contain properties, such as number of cores, RAM, and the storage size.

Authorizations:
basicAuthtokenAuth
query Parameters
limit
integer [ 1 .. 1000 ]
Default: 100
Example: limit=100

The maximum number of elements to return. Use together with 'offset' for pagination.

offset
integer
Default: 0
Example: offset=200

The first element to return. Use together with 'limit' for pagination.

Responses

Response samples

Content type
application/json
{
  • "type": "collection",
  • "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  • "items": [
    ],
  • "offset": 200,
  • "limit": 100,
  • "links": {
    }
}