# upcloud.ServerApi
All URIs are relative to *https://api.upcloud.com/1.2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**assignTag**](ServerApi.md#assignTag) | **POST** /server/{serverId}/tag/{tagList} | Assign tag to a server
[**attachStorage**](ServerApi.md#attachStorage) | **POST** /server/{serverId}/storage/attach | Attach storage
[**createFirewallRule**](ServerApi.md#createFirewallRule) | **POST** /server/{serverId}/firewall_rule | Create firewall rule
[**createServer**](ServerApi.md#createServer) | **POST** /server | Create server
[**deleteFirewallRule**](ServerApi.md#deleteFirewallRule) | **DELETE** /server/{serverId}/firewall_rule/{firewallRuleNumber} | Remove firewall rule
[**deleteServer**](ServerApi.md#deleteServer) | **DELETE** /server/{serverId} | Delete server
[**detachStorage**](ServerApi.md#detachStorage) | **POST** /server/{serverId}/storage/detach | Detach storage
[**ejectCdrom**](ServerApi.md#ejectCdrom) | **POST** /server/{serverId}/cdrom/eject | Eject CD-ROM
[**getFirewallRule**](ServerApi.md#getFirewallRule) | **GET** /server/{serverId}/firewall_rule/{firewallRuleNumber} | Get firewall rule details
[**listServerConfigurations**](ServerApi.md#listServerConfigurations) | **GET** /server_size | List server configurations
[**listServers**](ServerApi.md#listServers) | **GET** /server | List of servers
[**loadCdrom**](ServerApi.md#loadCdrom) | **POST** /server/{serverId}/storage/cdrom/load | Load CD-ROM
[**modifyServer**](ServerApi.md#modifyServer) | **PUT** /server/{serverId} | Modify server
[**restartServer**](ServerApi.md#restartServer) | **POST** /server/{serverId}/restart | Restart server
[**serverDetails**](ServerApi.md#serverDetails) | **GET** /server/{serverId} | Get server details
[**serverServerIdFirewallRuleGet**](ServerApi.md#serverServerIdFirewallRuleGet) | **GET** /server/{serverId}/firewall_rule | List firewall rules
[**startServer**](ServerApi.md#startServer) | **POST** /server/{serverId}/start | Start server
[**stopServer**](ServerApi.md#stopServer) | **POST** /server/{serverId}/stop | Stop server
[**untag**](ServerApi.md#untag) | **POST** /server/{serverId}/untag/{tagName} | Remove tag from server
# **assignTag**
> CreateServerResponse assignTag(serverId, tagList)
Assign tag to a server
Servers can be tagged with one or more tags. The tags used must exist
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
var tagList = "tagList_example"; // String | List of tags
apiInstance.assignTag(serverId, tagList).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
**tagList** | **String**| List of tags |
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **attachStorage**
> CreateServerResponse attachStorage(serverId, storageDevice)
Attach storage
Attaches a storage as a device to a server.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
var storageDevice = new upcloud.AttachStorageDeviceRequest(); // AttachStorageDeviceRequest |
apiInstance.attachStorage(serverId, storageDevice).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
**storageDevice** | [**AttachStorageDeviceRequest**](AttachStorageDeviceRequest.md)| |
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **createFirewallRule**
> FirewallRuleCreateResponse createFirewallRule(serverId, firewallRule)
Create firewall rule
Creates a new firewall rule
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
var firewallRule = new upcloud.FirewallRuleRequest(); // FirewallRuleRequest |
apiInstance.createFirewallRule(serverId, firewallRule).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
**firewallRule** | [**FirewallRuleRequest**](FirewallRuleRequest.md)| |
### Return type
[**FirewallRuleCreateResponse**](FirewallRuleCreateResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **createServer**
> CreateServerResponse createServer(opts)
Create server
Creates a new server instance.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var opts = {
'server': new upcloud.CreateServerRequest() // CreateServerRequest |
};
apiInstance.createServer(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**server** | [**CreateServerRequest**](CreateServerRequest.md)| | [optional]
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **deleteFirewallRule**
> deleteFirewallRule(serverId, firewallRuleNumber)
Remove firewall rule
Removes a firewall rule from a server. Firewall rules must be removed individually. The positions of remaining firewall rules will be adjusted after a rule is removed.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
var firewallRuleNumber = 3.4; // Number | Denotes the index of the firewall rule in the server's firewall rule list
apiInstance.deleteFirewallRule(serverId, firewallRuleNumber).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
**firewallRuleNumber** | **Number**| Denotes the index of the firewall rule in the server's firewall rule list |
### Return type
null (empty response body)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **deleteServer**
> deleteServer(serverId)
Delete server
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Id of server to delete
apiInstance.deleteServer(serverId).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Id of server to delete |
### Return type
null (empty response body)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **detachStorage**
> CreateServerResponse detachStorage(serverId, storageDevice)
Detach storage
Detaches a storage resource from a server.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
var storageDevice = new upcloud.StorageDeviceDetachRequest(); // StorageDeviceDetachRequest |
apiInstance.detachStorage(serverId, storageDevice).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
**storageDevice** | [**StorageDeviceDetachRequest**](StorageDeviceDetachRequest.md)| |
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **ejectCdrom**
> ejectCdrom(serverId)
Eject CD-ROM
Ejects the storage from the CD-ROM device of a server.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
apiInstance.ejectCdrom(serverId).then(function() {
console.log('API called successfully.');
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
### Return type
null (empty response body)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **getFirewallRule**
> FirewallRuleCreateResponse getFirewallRule(serverId, firewallRuleNumber)
Get firewall rule details
Returns detailed information about a specific firewall rule
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
var firewallRuleNumber = 3.4; // Number | Denotes the index of the firewall rule in the server's firewall rule list
apiInstance.getFirewallRule(serverId, firewallRuleNumber).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
**firewallRuleNumber** | **Number**| Denotes the index of the firewall rule in the server's firewall rule list |
### Return type
[**FirewallRuleCreateResponse**](FirewallRuleCreateResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **listServerConfigurations**
> ConfigurationListResponse listServerConfigurations()
List server configurations
Returns a list of available server configurations. A server configuration consists of a combination of CPU core count and main memory amount. All servers are created using these configurations.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
apiInstance.listServerConfigurations().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**ConfigurationListResponse**](ConfigurationListResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **listServers**
> ServerListResponse listServers()
List of servers
Returns a list of all servers associated with the current account.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
apiInstance.listServers().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**ServerListResponse**](ServerListResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **loadCdrom**
> CreateServerResponse loadCdrom(serverId, opts)
Load CD-ROM
Loads a storage as a CD-ROM in the CD-ROM device of a server.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
var opts = {
'storageDevice': new upcloud.StorageDeviceLoadRequest() // StorageDeviceLoadRequest |
};
apiInstance.loadCdrom(serverId, opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
**storageDevice** | [**StorageDeviceLoadRequest**](StorageDeviceLoadRequest.md)| | [optional]
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **modifyServer**
> CreateServerResponse modifyServer(serverId, opts)
Modify server
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Id of server to modify
var opts = {
'server': new upcloud.Server() // Server |
};
apiInstance.modifyServer(serverId, opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Id of server to modify |
**server** | [**Server**](Server.md)| | [optional]
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **restartServer**
> CreateServerResponse restartServer(serverId, restartServer)
Restart server
Stops and starts a server. The server state must be `started`.
### Example
```javascript
var upcloud = require('upcloud');
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Id of server to restart
var restartServer = new upcloud.RestartServer(); // RestartServer |
apiInstance.restartServer(serverId, restartServer).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Id of server to restart |
**restartServer** | [**RestartServer**](RestartServer.md)| |
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **serverDetails**
> CreateServerResponse serverDetails(serverId)
Get server details
Returns detailed information about a specific server.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Id of server to return
apiInstance.serverDetails(serverId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Id of server to return |
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **serverServerIdFirewallRuleGet**
> FirewallRuleListResponse serverServerIdFirewallRuleGet(serverId, )
List firewall rules
Returns a list of firewall rules for a specific server.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
apiInstance.serverServerIdFirewallRuleGet(serverId, ).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
### Return type
[**FirewallRuleListResponse**](FirewallRuleListResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **startServer**
> CreateServerResponse startServer(serverId)
Start server
Starts a stopped server. The server state must be `stopped`.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Id of server to start
apiInstance.startServer(serverId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Id of server to start |
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **stopServer**
> CreateServerResponse stopServer(serverId, stopServerRequest)
Stop server
Stops a started server. The server state must be `started`.
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Id of server to stop
var stopServerRequest = new upcloud.StopServer(); // StopServer |
apiInstance.stopServer(serverId, stopServerRequest).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Id of server to stop |
**stopServerRequest** | [**StopServer**](StopServer.md)| |
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# **untag**
> CreateServerResponse untag(serverId, tagName)
Remove tag from server
Untags tags from given server. The tag(s) must exist
### Example
```javascript
var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;
// Configure HTTP basic authorization: baseAuth
var baseAuth = defaultClient.authentications['baseAuth'];
baseAuth.username = 'YOUR USERNAME';
baseAuth.password = 'YOUR PASSWORD';
var apiInstance = new upcloud.ServerApi();
var serverId = "serverId_example"; // String | Server id
var tagName = "tagName_example"; // String | Tag name
apiInstance.untag(serverId, tagName).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**serverId** | **String**| Server id |
**tagName** | **String**| Tag name |
### Return type
[**CreateServerResponse**](CreateServerResponse.md)
### Authorization
[baseAuth](../README.md#baseAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json