# SCIM Network examples

## Operations

This page shows the operations that can be performed for the Network object.

### List all

##### Request

```MarkDown
GET https://<your-domain>/soffid/webservice/scim2/v1/Network
```

##### Response 200 OK

```JSON
{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:ListResponse"
    ],
    "totalResults": 6,
    "startIndex": 1,
    "Resources": [
        {
            "meta": {
                "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/Network/67",
                "resourceType": "Network"
            },
            "ip": "127.0.0.0",
            "lanAccess": false,
            "schemas": [
                "urn:soffid:com.soffid.iam.am.api.Network"
            ],
            "name": "loopback",
            "description": "Description",
            "id": 67,
            "mask": "255.255.255.128",
            "dhcpSupport": false
        },
        {
            "meta": {
                "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/Network/505167",
                "resourceType": "Network"
            },
            "ip": "172.0.0.0",
            "lanAccess": false,
            "schemas": [
                "urn:soffid:com.soffid.iam.am.api.Network"
            ],
            "name": "int1",
            "description": "Internal network 1",
            "id": 505167,
            "mask": "255.240.0.0",
            "dhcpSupport": false
        },
      ...............
    ]
}
```

### List by filter

List all Networks with a filter expression.

<p class="callout info">It is allowed to use pagination and sort the information, for more information visit the [Sorting](https://bookstack.soffid.com/link/116#bkmrk-sorting) and [Pagination](https://bookstack.soffid.com/link/116#bkmrk-pagination) information.</p>

##### Request

```MarkDown
GET https://<your-domain>/soffid/webservice/scim2/v1/Network?filter=description co labora
```

##### Response 200 OK

```JSON
{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:ListResponse"
    ],
    "totalResults": 3,
    "startIndex": 1,
    "Resources": [
        {
            "meta": {
                "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/Network/1790267",
                "resourceType": "Network"
            },
            "ip": "10.129.120.0",
            "lanAccess": false,
            "schemas": [
                "urn:soffid:com.soffid.iam.am.api.Network"
            ],
            "name": "lab1",
            "description": "Laboratory network 1",
            "id": 1790267,
            "mask": "255.255.255.0",
            "dhcpSupport": false
        },
        {
            "meta": {
                "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/Network/1790319",
                "resourceType": "Network"
            },
            "ip": "10.129.121.0",
            "lanAccess": false,
            "schemas": [
                "urn:soffid:com.soffid.iam.am.api.Network"
            ],
            "name": "lab2",
            "description": "Laboratory network 2",
            "id": 1790319,
            "mask": "255.255.255.0",
            "dhcpSupport": false
        },
        {
            "meta": {
                "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/Network/1858961",
                "resourceType": "Network"
            },
            "ip": "10.129.122.0",
            "lanAccess": true,
            "schemas": [
                "urn:soffid:com.soffid.iam.am.api.Network"
            ],
            "name": "lab3",
            "description": "Laboratory network",
            "id": 1858961,
            "mask": "255.255.255.0",
            "dhcpSupport": false
        }
    ]
}
```

### Query by id

Query a Network by its id (primary key).

##### Request

```MarkDown
GET https://<your-domain>/soffid/webservice/scim2/v1/Network/1038187
```

##### Response 200 OK

```JSON
{
    "meta": {
        "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/Network/1038187",
        "resourceType": "Network"
    },
    "ip": "192.168.133.0",
    "lanAccess": true,
    "schemas": [
        "urn:soffid:com.soffid.iam.am.api.Network"
    ],
    "name": "internal",
    "description": "Internal Network",
    "loginRestriction": false,
    "id": 1038187,
    "mask": "255.255.255.0",
    "dhcpSupport": true
}
```

### Create

#### Request

```XML
POST https://<your-domain>/soffid/webservice/scim2/v1/Network
```

**JSON**

```JSON
{
    "schemas": [
        "urn:soffid:com.soffid.iam.api.Network"
    ],
    "name": "Laboratory",
    "description": "Laboratory Network",
    "ip": "192.168.123.0",
    "mask": "255.255.255.0",
    "loginRestriction": false,
    "lanAccess": true,
    "dhcpSupport": true
}
```

##### Response 201 Created

```JSON
{
    "meta": {
        "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/Network/1977114",
        "resourceType": "Network"
    },
    "ip": "192.168.123.0",
    "lanAccess": true,
    "schemas": [
        "urn:soffid:com.soffid.iam.api.Network"
    ],
    "name": "Laboratory",
    "description": "Laboratory Network",
    "loginRestriction": false,
    "id": 1977114,
    "mask": "255.255.255.0",
    "dhcpSupport": true
}
```

### Update partial

Only attributes with changes will be updated, the other will maintain the same value.

##### Request

```
PATCH https://<your-domain>/soffid/webservice/scim2/v1/Network/1977114
```

**JSON**

```JSON
{
    "Operations": [
        {
            "op": "replace",
            "path": "ip",
            "value": "192.168.125.0"
        }
    ]
}
```

##### Response 200 OK

```JSON
{
    "meta": {
        "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/Network/1977114",
        "resourceType": "Network"
    },
    "ip": "192.168.123.0",
    "lanAccess": true,
    "schemas": [
        "urn:soffid:com.soffid.iam.am.api.Network"
    ],
    "name": "Laboratory",
    "description": "Laboratory Network",
    "loginRestriction": false,
    "id": 1977114,
    "mask": "255.255.255.0",
    "dhcpSupport": true
}
```

### Update all

This operation replaces all values in the Network.

- Note that the attribute id is required to confirm that the resource "...Network/&lt;id&gt;" is the same that the JSON Network.
- Note that all the attributes not included in the request will be cleared in the Network type and their data will be lost.
- Note that not all the attributes are updatable, for example, tag meta, avoid these tags. For more information visit [Resource data model page](https://bookstack.soffid.com/books/scim/chapter/resource-data-model-schema)

##### Request

```XML
PUT https://<your-domain>/soffid/webservice/scim2/v1/Network/1977114
```

**JSON**

```JSON
{
    "schemas": [
        "urn:soffid:com.soffid.iam.am.api.Network"
    ],
    "id": 1977114,
    "name": "Laboratory",
    "ip": "192.168.123.0",
    "mask": "255.255.255.0"
}
```

##### Response 200 OK

```JSON
{
    "meta": {
        "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/Network/1977114",
        "resourceType": "Network"
    },
    "ip": "192.168.123.0",
    "schemas": [
        "urn:soffid:com.soffid.iam.am.api.Network"
    ],
    "name": "Laboratory",
    "id": 1977114,
    "mask": "255.255.255.0",
    "dhcpSupport": false
}
```

### Delete

<p class="callout warning">Please note after this delete, the network has to be created again to use it in the next examples.</p>

##### Request

```MarkDown
DELETE https://<your-omain>/soffid/webservice/scim2/v1/Network/1977114
```

##### Response 204 No Content

```
204 No Content
```

### Error response

<p class="callout info">For more information about error response visit [https://bookstack.soffid.com/link/116#bkmrk-error-response](https://bookstack.soffid.com/link/116#bkmrk-error-response)</p>