> This page is for NVIDIA Infra Controller.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/infra-controller/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/infra-controller/_mcp/server.

# Replace all Expected Power Shelves

PUT https://nico-rest-api.nico.svc.cluster.local/v2/org/{org}/nico/expected-power-shelf/all
Content-Type: application/json

Replace the complete Expected Power Shelf set for one Site. Entries omitted from the request are deleted, and entries in the request are created with new REST IDs. The `expectedPowerShelves` array may be empty to clear the Site's set.

Every entry must use the top-level `siteId`. BMC MAC addresses and shelf serial numbers must be unique within the replacement set.

Org must have an Infrastructure Provider entity. User must have authorization role with `PROVIDER_ADMIN` suffix.

Alternatively, Tenant Admins with `TargetedInstanceCreation` capability can also replace Expected Power Shelves if they have an account with the Site's Infrastructure Provider.

Reference: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/expected-power-shelf/replace-all-expected-power-shelf

## Authentication

- `Authorization` header (bearer token, required) — ``` export JWT_BEARER_TOKEN="<jwt-bearer-token>" # Example org name: "acme-inc export ORG_NAME=<org-name> # Use the JWT bearer token in your API request auth header: curl -v -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $JWT_BEARER_TOKEN" https://nico-rest-api.nico.svc.cluster.local/v2/org/$ORG_NAME/nico/user/current ```

## Request

### Path parameters

- `org` (string, required) — Name of the Org

### Body (application/json)

This endpoint expects an ExpectedPowerShelfList.

- `siteId` (string, required) — ID of the Site whose Expected Power Shelves should be replaced
- `expectedPowerShelves` (list of ExpectedPowerShelfCreateRequest, required) — Full desired Expected Power Shelf set; BMC MAC addresses and shelf serial numbers must be unique

## Response

### 200

Expected Power Shelves replaced successfully

- `list of ExpectedPowerShelf`

## Errors

### 400 Bad Request Error

Error response when request data cannot be validated

- `source` (string, optional) — Source of the error, taken from `api.name` in the REST API server configuration file (`/app/config.yaml` in the supplied Kubernetes deployment; default API name `nico`). This is a configurable string, for example `nico` or `carbide`
- `message` (string, optional) — Message describing the error
- `data` (NiCoApiErrorData, optional, nullable) — Additional data about the error
- `retryable` (boolean, optional) — True permits bounded retries with backoff, without guaranteeing success. False prohibits automatic retries. Omission means unclassified.

### 403 Forbidden Error

Error response when user is not authorized to call an endpoint or retrieve/modify objects

- `source` (string, optional) — Source of the error, taken from `api.name` in the REST API server configuration file (`/app/config.yaml` in the supplied Kubernetes deployment; default API name `nico`). This is a configurable string, for example `nico` or `carbide`
- `message` (string, optional) — Message describing the error
- `data` (NiCoApiErrorData, optional, nullable) — Additional data about the error
- `retryable` (boolean, optional) — True permits bounded retries with backoff, without guaranteeing success. False prohibits automatic retries. Omission means unclassified.

### 409 Conflict Error

Error response when the request conflicts with an existing resource or operation

- `source` (string, optional) — Source of the error, taken from `api.name` in the REST API server configuration file (`/app/config.yaml` in the supplied Kubernetes deployment; default API name `nico`). This is a configurable string, for example `nico` or `carbide`
- `message` (string, optional) — Message describing the error
- `data` (NiCoApiErrorData, optional, nullable) — Additional data about the error
- `retryable` (boolean, optional) — True permits bounded retries with backoff, without guaranteeing success. False prohibits automatic retries. Omission means unclassified.

## Types

### ExpectedPowerShelfCreateRequest

Request data to create a new Expected Power Shelf. Note: BMC credentials (username/password) are only accepted during creation and updates but are not returned in responses.

- `siteId` (string, required) — ID of the site the Expected Power Shelf belongs to
- `bmcMacAddress` (string, required) — MAC address of the Expected Power Shelf's BMC (Baseboard Management Controller)
- `shelfSerialNumber` (string, required) — Serial number of the Expected Power Shelf
- `defaultBmcUsername` (string, optional, nullable) — Username for accessing the Expected Power Shelf's BMC
- `defaultBmcPassword` (string, optional, nullable) — Password for accessing the Expected Power Shelf's BMC
- `bmcIpAddress` (string, optional, nullable) — Optional BMC IP address (IPv4 or IPv6). When set, pre-allocates a reserved IP for the BMC. It must not be unspecified, multicast, or IPv4 limited broadcast.
- `rackId` (string, optional, nullable) — Optional rack identifier for this component
- `name` (string, optional, nullable) — Display name for this component
- `manufacturer` (string, optional, nullable) — Manufacturer of this component
- `model` (string, optional, nullable) — Model of this component
- `description` (string, optional, nullable) — Description of this component
- `slotId` (integer, optional, nullable) — Slot ID within the rack
- `trayIdx` (integer, optional, nullable) — Tray index within the rack
- `hostId` (integer, optional, nullable) — Host ID within the tray
- `labels` (map from string to string, optional) — User-defined key-value pairs for organizing and categorizing Expected Power Shelves

### ExpectedPowerShelf

An Expected Power Shelf represents a power shelf that is expected to be discovered at a site, with hardware identifiers and metadata. Note: BMC credentials (username/password) are only accepted during creation and updates but are not returned in responses.

- `id` (string, optional) — Unique identifier for the Expected Power Shelf
- `siteId` (string, optional) — ID of the site the Expected Power Shelf belongs to
- `bmcMacAddress` (string, optional) — MAC address of the Expected Power Shelf's BMC (Baseboard Management Controller)
- `shelfSerialNumber` (string, optional) — Serial number of the Expected Power Shelf
- `bmcIpAddress` (string, optional, nullable) — Optional BMC IP address (IPv4 or IPv6). When set, pre-allocates a reserved IP for the BMC.
- `rackId` (string, optional, nullable) — Optional rack identifier for this component
- `name` (string, optional, nullable) — Display name for this component
- `manufacturer` (string, optional, nullable) — Manufacturer of this component
- `model` (string, optional, nullable) — Model of this component
- `description` (string, optional, nullable) — Description of this component
- `slotId` (integer, optional, nullable) — Slot ID within the rack
- `trayIdx` (integer, optional, nullable) — Tray index within the rack
- `hostId` (integer, optional, nullable) — Host ID within the tray
- `labels` (map from string to string, optional) — User-defined key-value pairs for organizing and categorizing Expected Power Shelves
- `created` (datetime, optional) — ISO 8601 datetime when the Expected Power Shelf was created
- `updated` (datetime, optional) — ISO 8601 datetime when the Expected Power Shelf was last updated

### NiCoApiErrorData

Additional data about the error

## Examples

**Request**

```json
{
  "siteId": "f97df110-f4de-492e-8849-4a6af68026b0",
  "expectedPowerShelves": [
    {
      "siteId": "f97df110-f4de-492e-8849-4a6af68026b0",
      "bmcMacAddress": "00:1A:2B:3C:4D:70",
      "shelfSerialNumber": "SHELF-12345",
      "defaultBmcUsername": "admin",
      "defaultBmcPassword": "securePass!2024",
      "labels": {
        "rack": "A1"
      }
    }
  ]
}
```

**Response**

```json
[
  {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "siteId": "f97df110-f4de-492e-8849-4a6af68026b0",
    "bmcMacAddress": "00:1A:2B:3C:4D:70",
    "shelfSerialNumber": "SHELF-12345",
    "bmcIpAddress": "192.168.100.10",
    "rackId": "rack-A1",
    "name": "Power Shelf A1-01",
    "manufacturer": "Delta Electronics",
    "model": "DPS-5000",
    "description": "Primary power shelf in rack A1",
    "slotId": 3,
    "trayIdx": 1,
    "hostId": 12,
    "labels": {},
    "created": "2024-01-15T09:30:00Z",
    "updated": "2024-01-15T09:30:00Z"
  }
]
```

**SDK Code**

```python
import requests

url = "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/expected-power-shelf/all"

payload = {
    "siteId": "f97df110-f4de-492e-8849-4a6af68026b0",
    "expectedPowerShelves": [
        {
            "siteId": "f97df110-f4de-492e-8849-4a6af68026b0",
            "bmcMacAddress": "00:1A:2B:3C:4D:70",
            "shelfSerialNumber": "SHELF-12345",
            "defaultBmcUsername": "admin",
            "defaultBmcPassword": "securePass!2024",
            "labels": { "rack": "A1" }
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/expected-power-shelf/all';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"siteId":"f97df110-f4de-492e-8849-4a6af68026b0","expectedPowerShelves":[{"siteId":"f97df110-f4de-492e-8849-4a6af68026b0","bmcMacAddress":"00:1A:2B:3C:4D:70","shelfSerialNumber":"SHELF-12345","defaultBmcUsername":"admin","defaultBmcPassword":"securePass!2024","labels":{"rack":"A1"}}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/expected-power-shelf/all"

	payload := strings.NewReader("{\n  \"siteId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n  \"expectedPowerShelves\": [\n    {\n      \"siteId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n      \"bmcMacAddress\": \"00:1A:2B:3C:4D:70\",\n      \"shelfSerialNumber\": \"SHELF-12345\",\n      \"defaultBmcUsername\": \"admin\",\n      \"defaultBmcPassword\": \"securePass!2024\",\n      \"labels\": {\n        \"rack\": \"A1\"\n      }\n    }\n  ]\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/expected-power-shelf/all")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"siteId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n  \"expectedPowerShelves\": [\n    {\n      \"siteId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n      \"bmcMacAddress\": \"00:1A:2B:3C:4D:70\",\n      \"shelfSerialNumber\": \"SHELF-12345\",\n      \"defaultBmcUsername\": \"admin\",\n      \"defaultBmcPassword\": \"securePass!2024\",\n      \"labels\": {\n        \"rack\": \"A1\"\n      }\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/expected-power-shelf/all")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"siteId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n  \"expectedPowerShelves\": [\n    {\n      \"siteId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n      \"bmcMacAddress\": \"00:1A:2B:3C:4D:70\",\n      \"shelfSerialNumber\": \"SHELF-12345\",\n      \"defaultBmcUsername\": \"admin\",\n      \"defaultBmcPassword\": \"securePass!2024\",\n      \"labels\": {\n        \"rack\": \"A1\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/expected-power-shelf/all', [
  'body' => '{
  "siteId": "f97df110-f4de-492e-8849-4a6af68026b0",
  "expectedPowerShelves": [
    {
      "siteId": "f97df110-f4de-492e-8849-4a6af68026b0",
      "bmcMacAddress": "00:1A:2B:3C:4D:70",
      "shelfSerialNumber": "SHELF-12345",
      "defaultBmcUsername": "admin",
      "defaultBmcPassword": "securePass!2024",
      "labels": {
        "rack": "A1"
      }
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/expected-power-shelf/all");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"siteId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n  \"expectedPowerShelves\": [\n    {\n      \"siteId\": \"f97df110-f4de-492e-8849-4a6af68026b0\",\n      \"bmcMacAddress\": \"00:1A:2B:3C:4D:70\",\n      \"shelfSerialNumber\": \"SHELF-12345\",\n      \"defaultBmcUsername\": \"admin\",\n      \"defaultBmcPassword\": \"securePass!2024\",\n      \"labels\": {\n        \"rack\": \"A1\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "siteId": "f97df110-f4de-492e-8849-4a6af68026b0",
  "expectedPowerShelves": [
    [
      "siteId": "f97df110-f4de-492e-8849-4a6af68026b0",
      "bmcMacAddress": "00:1A:2B:3C:4D:70",
      "shelfSerialNumber": "SHELF-12345",
      "defaultBmcUsername": "admin",
      "defaultBmcPassword": "securePass!2024",
      "labels": ["rack": "A1"]
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/expected-power-shelf/all")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```