# Issuing Restock

The Issuing Restock resource is used to request additional card blanks when your stock is running low.

Each restock request specifies the quantity needed and the stock to replenish.

Monitor the status of your restock requests through the log endpoints.

### The Issuing Restock object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique identifier for the issuing restock. |
| `count` | INTEGER | Number of card blanks requested in this restock. |
| `stockId` | STRING | Id of the IssuingStock to be replenished. |
| `status` | STRING | Current restock status. Options: "created", "processing", "confirmed". |
| `tags` | LIST OF STRINGS | Tags associated with the restock. |
| `created` | STRING | Creation datetime. Example: "2022-01-01T00:00:00.000000+00:00". |
| `updated` | STRING | Last update datetime. Example: "2022-01-01T00:00:00.000000+00:00". |

### Create Issuing Restocks

`POST /v2/issuing-restock`

Use this route to create up to 100 new issuing restock requests at a time.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `count` | REQUIRED | Number of card blanks to request. Example: 100. |
| `stockId` | REQUIRED | Id of the IssuingStock to be replenished. |
| `tags` | OPTIONAL | Array of strings to tag the entity for future queries. |

**Request**

```python
import starkinfra

restocks = starkinfra.issuingrestock.create([
    starkinfra.IssuingRestock(
        count=100,
        stock_id="5715709195239424"
    )
])

for restock in restocks:
    print(restock)
```

**Response**

```python
IssuingRestock(
    id=6724771005489152,
    count=100,
    stock_id=5715709195239424,
    status=created,
    tags=[],
    created=2022-01-01 00:00:00,
    updated=2022-01-01 00:00:00
)
```

### List Issuing Restocks

`GET /v2/issuing-restock`

Get a list of issuing restock requests in chunks of at most 100.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `status` | OPTIONAL | Filter for status of retrieved entities. Options: "created", "processing", "confirmed". |
| `stockIds` | OPTIONAL | List of IssuingStock ids to filter retrieved entities. |
| `ids` | OPTIONAL | List of strings to get specific entities by ids. |
| `tags` | OPTIONAL | List of strings to filter retrieved entities by tags. |

**Request**

```python
import starkinfra

restocks = starkinfra.issuingrestock.query(limit=10)

for restock in restocks:
    print(restock)
```

**Response**

```python
IssuingRestock(
    id=6724771005489152,
    count=100,
    stock_id=5715709195239424,
    status=confirmed,
    tags=[],
    created=2022-01-01 00:00:00,
    updated=2022-01-01 00:00:00
)
```

### Get an Issuing Restock

`GET /v2/issuing-restock/:id`

Get a single issuing restock by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the issuing restock entity. |

**Request**

```python
import starkinfra

restock = starkinfra.issuingrestock.get("6724771005489152")

print(restock)
```

**Response**

```python
IssuingRestock(
    id=6724771005489152,
    count=100,
    stock_id=5715709195239424,
    status=confirmed,
    tags=[],
    created=2022-01-01 00:00:00,
    updated=2022-01-01 00:00:00
)
```

### List Issuing Restock Logs

`GET /v2/issuing-restock/log`

Get a paged list of issuing restock logs.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `types` | OPTIONAL | Filter logs by log types. |
| `restockIds` | OPTIONAL | Array of restock ids to filter logs. |
| `ids` | OPTIONAL | List of strings to get specific entities by ids. |

**Request**

```python
import starkinfra

logs = starkinfra.issuingrestock.log.query(
    limit=10,
    types=["confirmed"]
)

for log in logs:
    print(log)
```

**Response**

```python
Log(
    id=7834882116598271,
    type=confirmed,
    restock=IssuingRestock(id=6724771005489152, status=confirmed),
    created=2022-01-01 00:00:00
)
```

### Get an Issuing Restock Log

`GET /v2/issuing-restock/log/:id`

Get a single issuing restock log by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the log entity. |

**Request**

```python
import starkinfra

log = starkinfra.issuingrestock.log.get("7834882116598271")

print(log)
```

**Response**

```python
Log(
    id=7834882116598271,
    type=confirmed,
    restock=IssuingRestock(id=6724771005489152, status=confirmed),
    created=2022-01-01 00:00:00
)
```

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkinfra.com/api/v2/issuing-restock-python.md)
- [Node.js](https://docs.starkinfra.com/api/v2/issuing-restock-node.md)
- [PHP](https://docs.starkinfra.com/api/v2/issuing-restock-php.md)
- [Java](https://docs.starkinfra.com/api/v2/issuing-restock-java.md)
- [Ruby](https://docs.starkinfra.com/api/v2/issuing-restock-ruby.md)
- [Elixir](https://docs.starkinfra.com/api/v2/issuing-restock-elixir.md)
- [.NET](https://docs.starkinfra.com/api/v2/issuing-restock-dotnet.md)
- [Go](https://docs.starkinfra.com/api/v2/issuing-restock-go.md)
- [Clojure](https://docs.starkinfra.com/api/v2/issuing-restock-clojure.md)
- [cURL](https://docs.starkinfra.com/api/v2/issuing-restock-curl.md)
