Partially modify NICs
1 min
PATCH
https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}
Path Parameters
- datacenterIdstringrequiredDescription
- serverIdstringrequiredDescription
- nicIdstringrequiredDescription
Query Parameters
- prettybooleanDescriptionDefaulttrue
- depthinteger<int32>DescriptionDefault0Formatint32Minimum0Maximum10
Header Parameters
- X-Contract-Numberinteger<int32>DescriptionFormatint32
Body Parameters
- bodyNicPropertiesrequiredDescription
- namestringExampleDescription
- macstringExampleDescription
- ipsstring[]Example
[ "10.160.12.12" ]
Description - dhcpbooleanExampleDescriptionDefaulttrue
- ipv6Ipsstring[]Example
[ "2001:db8:b06d:8f5a:0609::1" ]
Description - ipv6CidrBlockstringExampleDescription
- dhcpv6booleanExampleDescriptionDefaulttrue
- laninteger<int32>requiredExampleDescriptionFormatint32
- firewallActivebooleanDescription
- firewallTypestring<INGRESS | EGRESS | BIDIRECTIONAL>ExampleDescriptionAllowedINGRESSEGRESSBIDIRECTIONAL
- vnetstringDescription
Responses
202
- Nic
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesNicPropertiesrequired
- namestringExampleDescription
- macstringExampleDescription
- ipsstring[]Example
[ "10.160.12.12" ]
Description - dhcpbooleanExampleDescriptionDefaulttrue
- ipv6Ipsstring[]Example
[ "2001:db8:b06d:8f5a:0609::1" ]
Description - ipv6CidrBlockstringExampleDescription
- dhcpv6booleanExampleDescriptionDefaulttrue
- laninteger<int32>requiredExampleDescriptionFormatint32
- firewallActivebooleanDescription
- firewallTypestring<INGRESS | EGRESS | BIDIRECTIONAL>ExampleDescriptionAllowedINGRESSEGRESSBIDIRECTIONAL
- deviceNumberinteger<int32>ExampleDescriptionFormatint32
- pciSlotinteger<int32>ExampleDescriptionFormatint32
- vnetstringDescription
- entitiesNicEntities
- flowlogsFlowLogs
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsFlowLog[]Description
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesFlowLogPropertiesrequired
- namestringrequiredExampleDescription
- actionstring<ACCEPTED | REJECTED | ALL>requiredExampleDescriptionAllowedACCEPTEDREJECTEDALL
- directionstring<INGRESS | EGRESS | BIDIRECTIONAL>requiredExampleDescriptionAllowedINGRESSEGRESSBIDIRECTIONAL
- bucketstringrequiredExampleDescription
- offsetPaginationOffsetOptionalDescription
- limitPaginationLimitOptionalExampleDescription
- _linksPaginationLinks
- prevstring<uri>ExampleDescriptionFormaturi
- selfstring<uri>ExampleDescriptionFormaturi
- nextstring<uri>ExampleDescriptionFormaturi
- firewallrulesFirewallRules
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsFirewallRule[]Description
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesFirewallrulePropertiesrequired
- namestringExampleDescription
- protocolstring<TCP | UDP | ICMP | ICMPv6 | GRE | VRRP | ESP | AH | ANY>requiredExampleDescriptionAllowedTCPUDPICMPICMPv6GREVRRPESPAHANY
- sourceMacstringExampleDescription
- ipVersionstring<IPv4 | IPv6>ExampleDescriptionAllowedIPv4IPv6
- sourceIpstringExampleDescription
- targetIpstringExampleDescription
- icmpCodeinteger<int32>DescriptionFormatint32Minimum0Maximum254
- icmpTypeinteger<int32>ExampleDescriptionFormatint32Minimum0Maximum254
- portRangeStartinteger<int32>ExampleDescriptionFormatint32Minimum1Maximum65535
- portRangeEndinteger<int32>ExampleDescriptionFormatint32Minimum1Maximum65535
- typestring<INGRESS | EGRESS>ExampleDescriptionAllowedINGRESSEGRESS
- offsetPaginationOffsetOptionalDescription
- limitPaginationLimitOptionalExampleDescription
- _linksPaginationLinks
- prevstring<uri>ExampleDescriptionFormaturi
- selfstring<uri>ExampleDescriptionFormaturi
- nextstring<uri>ExampleDescriptionFormaturi
- securitygroupsSecurityGroups
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsSecurityGroup[]Description
- idstringExampleDescription
- typeobject
- Type
- hrefstring<uri>ExampleDescriptionFormaturi
- metadataDatacenterElementMetadata
- etagstringExampleDescription
- createdDatestring<date-time>ExampleDescriptionFormatdate-time
- createdBystringExampleDescription
- createdByUserIdstringExampleDescription
- lastModifiedDatestring<date-time>ExampleDescriptionFormatdate-time
- lastModifiedBystringExampleDescription
- lastModifiedByUserIdstringExampleDescription
- statestring<AVAILABLE | INACTIVE | BUSY | DEPLOYING | ACTIVE | FAILED | SUSPENDED | FAILED_SUSPENDED | UPDATING | FAILED_UPDATING | DESTROYING | FAILED_DESTROYING | TERMINATED | HIBERNATING | FAILED_HIBERNATING | MAINTENANCE | FAILED_MAINTENANCE | UNKNOWN>ExampleDescriptionAllowedAVAILABLEINACTIVEBUSYDEPLOYINGACTIVEFAILEDSUSPENDEDFAILED_SUSPENDEDUPDATINGFAILED_UPDATINGDESTROYINGFAILED_DESTROYINGTERMINATEDHIBERNATINGFAILED_HIBERNATINGMAINTENANCEFAILED_MAINTENANCEUNKNOWN
- propertiesSecurityGroupPropertiesrequired
- namestringrequiredExampleDescriptionMax Length60
- descriptionstringExampleDescriptionMax Length300
- entitiesSecurityGroupEntities
- rulesFirewallRules
- idstringExampleDescription
- typeobject
- Type
- Max depth limit reached
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsFirewallRule[]Description
- Max depth limit reached
- offsetPaginationOffsetOptionalDescription
- Max depth limit reached
- limitPaginationLimitOptionalExampleDescription
- Max depth limit reached
- _linksPaginationLinks
- Max depth limit reached
- nicsNics
- idstringExampleDescription
- typeobject
- Type
- Max depth limit reached
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsNic[]Description
- Max depth limit reached
- offsetPaginationOffsetOptionalDescription
- Max depth limit reached
- limitPaginationLimitOptionalExampleDescription
- Max depth limit reached
- _linksPaginationLinks
- Max depth limit reached
- serversServers
- idstringExampleDescription
- typeobject
- Type
- Max depth limit reached
- hrefstring<uri>ExampleDescriptionFormaturi
- itemsServer[]Description
- Max depth limit reached
- offsetPaginationOffsetOptionalDescription
- Max depth limit reached
- limitPaginationLimitOptionalExampleDescription
- Max depth limit reached
- _linksPaginationLinks
- Max depth limit reached
- offsetPaginationOffsetOptionalDescription
- limitPaginationLimitOptionalExampleDescription
- _linksPaginationLinks
- prevstring<uri>ExampleDescriptionFormaturi
- selfstring<uri>ExampleDescriptionFormaturi
- nextstring<uri>ExampleDescriptionFormaturi
Response Headers
- X-RateLimit-Remaininginteger<int32>DescriptionFormatint32
- X-RateLimit-Limitinteger<int32>DescriptionFormatint32
- X-RateLimit-Burstinteger<int32>DescriptionFormatint32
- LocationstringDescriptionPatternhttps://[apiBaseUri]/requests/[requestId]/status
default
- Error
- httpStatusinteger<int32>ExampleDescriptionFormatint32
- messagesErrorMessage[]
- errorCodestringExampleDescription
- messagestringExampleDescription
curl
curl --request PATCH \
--url 'https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}?pretty=true&depth=integer%3Cint32%3E' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"dhcp": true,
"dhcpv6": true,
"lan": 2
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"dhcp": true,
"dhcpv6": true,
"lan": 2
});
var requestOptions = {
method: 'PATCH',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}?pretty=true&depth=integer<int32>", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}?pretty=true&depth=integer<int32>")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"dhcp": true,
"dhcpv6": true,
"lan": 2
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}?pretty=true&depth=integer<int32>"
payload = json.dumps({
"dhcp": True,
"dhcpv6": True,
"lan": 2
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
202
// Successful operation
{
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"metadata": {
"etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
"createdDate": "2015-12-04T14:34:09.809Z",
"createdBy": "[email protected]",
"createdByUserId": "[email protected]",
"lastModifiedDate": "2015-12-04T14:34:09.809Z",
"lastModifiedBy": "[email protected]",
"lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
"state": "AVAILABLE"
},
"properties": {
"name": "My resource",
"mac": "00:0a:95:9d:68:16",
"ips": [
""
],
"dhcp": true,
"ipv6Ips": [
""
],
"ipv6CidrBlock": "2001:db8:b06d:8f5a:0609::/80",
"dhcpv6": true,
"lan": 2,
"firewallActive": false,
"firewallType": "INGRESS",
"deviceNumber": 3,
"pciSlot": 7,
"vnet": ""
},
"entities": {
"flowlogs": {
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"items": [
{
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"metadata": {
"etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
"createdDate": "2015-12-04T14:34:09.809Z",
"createdBy": "[email protected]",
"createdByUserId": "[email protected]",
"lastModifiedDate": "2015-12-04T14:34:09.809Z",
"lastModifiedBy": "[email protected]",
"lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
"state": "AVAILABLE"
},
"properties": {
"name": "My resource",
"action": "ACCEPTED",
"direction": "INGRESS",
"bucket": "bucketName/key"
}
}
],
"offset": 0,
"limit": 1000,
"_links": {
"prev": "<PREVIOUS-PAGE-URI>",
"self": "<THIS-PAGE-URI>",
"next": "<NEXT-PAGE-URI>"
}
},
"firewallrules": {
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"items": [
{
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"metadata": {
"etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
"createdDate": "2015-12-04T14:34:09.809Z",
"createdBy": "[email protected]",
"createdByUserId": "[email protected]",
"lastModifiedDate": "2015-12-04T14:34:09.809Z",
"lastModifiedBy": "[email protected]",
"lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
"state": "AVAILABLE"
},
"properties": {
"name": "My resource",
"protocol": "TCP",
"sourceMac": "00:0a:95:9d:68:16",
"ipVersion": "IPv4",
"sourceIp": "22.231.113.64",
"targetIp": "22.231.113.64",
"icmpCode": "",
"icmpType": 8,
"portRangeStart": 8,
"portRangeEnd": 8,
"type": "INGRESS"
}
}
],
"offset": 0,
"limit": 1000,
"_links": {
"prev": "<PREVIOUS-PAGE-URI>",
"self": "<THIS-PAGE-URI>",
"next": "<NEXT-PAGE-URI>"
}
},
"securitygroups": {
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"items": [
{
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"metadata": {
"etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
"createdDate": "2015-12-04T14:34:09.809Z",
"createdBy": "[email protected]",
"createdByUserId": "[email protected]",
"lastModifiedDate": "2015-12-04T14:34:09.809Z",
"lastModifiedBy": "[email protected]",
"lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
"state": "AVAILABLE"
},
"properties": {
"name": "My security group",
"description": "My security group description"
},
"entities": {
"rules": {
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"items": [
{
"": ""
}
],
"offset": 0,
"limit": 1000,
"_links": {
"": ""
}
},
"nics": {
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"items": [
{
"": ""
}
],
"offset": 0,
"limit": 1000,
"_links": {
"": ""
}
},
"servers": {
"id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
"type": {},
"href": "<RESOURCE-URI>",
"items": [
{
"": ""
}
],
"offset": 0,
"limit": 1000,
"_links": {
"": ""
}
}
}
}
],
"offset": 0,
"limit": 1000,
"_links": {
"prev": "<PREVIOUS-PAGE-URI>",
"self": "<THIS-PAGE-URI>",
"next": "<NEXT-PAGE-URI>"
}
}
}
}default
// Any erroneous status code: 400 (parse error), 401 (auth error), 402 (trial access), 403 (insufficient privileges), 404 (not found), 405 (unsupported HTTP method), 415 (unsupported content type, 422 (validation error), 429 (request rate limit exceeded), 500 (server error), or 503 (maintenance).
{
"httpStatus": 400,
"messages": [
{
"errorCode": "123",
"message": "Error message example."
}
]
}Have a question?
Our super-smart AI, knowledgeable support team and an awesome community will get you an answer in a flash.
To ask a question or participate in discussions, you'll need to authenticate first.