# SCIM CustomObject examples

## Operations

This page shows the operations that can be performed for the CustomObjects object

### List all

##### Request

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

##### 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/webservice/scim2/v1/CustomObject/848157",
                "resourceType": "CustomObject"
            },
            "schemas": [
                "urn:soffid:com.soffid.iam.iga.api.CustomObject"
            ],
            "name": "aa",
            "description": "aaa",
            "attributes": {
                "address": "2"
            },
            "id": 848157,
            "type": "building"
        },
        {
            "meta": {
                "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/CustomObject/1510208",
                "resourceType": "CustomObject"
            },
            "schemas": [
                "urn:soffid:com.soffid.iam.iga.api.CustomObject"
            ],
            "name": "ES",
            "description": "Spain",
            "attributes": {
                "language": "English"
            },
            "id": 1510208,
            "type": "country"
        },
      ..........
    ]
}
```

### List by filter

List all CustomObjects 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/CustomObject?filter=description eq Spain
```

##### Response 200 OK

```JSON
{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:ListResponse"
    ],
    "totalResults": 1,
    "startIndex": 1,
    "Resources": [
        {
            "meta": {
                "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/CustomObject/1510208",
                "resourceType": "CustomObject"
            },
            "schemas": [
                "urn:soffid:com.soffid.iam.iga.api.CustomObject"
            ],
            "name": "ES",
            "description": "Spain",
            "attributes": {
                "language": "English"
            },
            "id": 1510208,
            "type": "country"
        }
    ]
}
```

### Query by id

Query a CustomObject by its id (primary key).

##### Request

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

##### Response 200 OK

```JSON
{
    "meta": {
        "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/CustomObject/848062",
        "resourceType": "CustomObject"
    },
    "schemas": [
        "urn:soffid:com.soffid.iam.iga.api.CustomObject"
    ],
    "name": "HQ",
    "description": "Headquarters",
    "attributes": {
        "address": "1"
    },
    "id": 848062,
    "type": "building"
}
```

### Create

#### Request

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

**JSON**

```JSON
{
    "schemas": [
        "urn:soffid:com.soffid.iam.iga.api.CustomObject"
    ],
    "name": "IT",
    "description": "Italy",
    "type": "country",
    "attributes": {
        "language": "English"
    }
}
```

##### Response 201 Created

```JSON
{
    "meta": {
        "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/CustomObject/1977187",
        "resourceType": "CustomObject"
    },
    "schemas": [
        "urn:soffid:com.soffid.iam.iga.api.CustomObject"
    ],
    "name": "IT",
    "description": "Italy",
    "attributes": {
        "language": "English"
    },
    "id": 1977187,
    "type": "country"
}
```

### 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/CustomObject/1977187
```

**JSON**

```JSON
{
  "schemas": [
        "urn:soffid:com.soffid.iam.iga.api.CustomObject"
    ],
    "Operations": [
        {
            "op": "replace",
            "path": "attributes",
            "value": {
                "language": "German"
            }
        }
    ]
}
```

##### Response 200 OK

```JSON
{
    "meta": {
        "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/CustomObject/1977187",
        "resourceType": "CustomObject"
    },
    "schemas": [
        "urn:soffid:com.soffid.iam.iga.api.CustomObject"
    ],
    "name": "IT",
    "description": "Italy",
    "attributes": {
        "language": "German"
    },
    "id": 1977187,
    "type": "country"
}
```

### Update all

This operation replaces all values in the CustomObject.

- Note that the attribute id is required to confirm that the resource "...CustomObject/&lt;id&gt;" is the same that the JSON CustomObject.
- Note that all the attributes not included in the request will be cleared in the CustomObject 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 see [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/CustomObject/1977187
```

**JSON**

```JSON
{
    "schemas": [
        "urn:soffid:com.soffid.iam.iga.api.CustomObject"
    ],
    "id": 1977187,
    "name": "IT",
    "description": "Italy",
    "type": "country",
    "attributes": {
        "language": "English"
    }
}
```

##### Response 200 OK

```JSON
{
    "meta": {
        "location": "http://soffid.pat.lab:8080/soffid/webservice/scim2/v1/CustomObject/1977187",
        "resourceType": "CustomObject"
    },
    "schemas": [
        "urn:soffid:com.soffid.iam.iga.api.CustomObject"
    ],
    "name": "IT",
    "description": "Italy",
    "attributes": {
        "language": "English"
    },
    "id": 1977187,
    "type": "country"
}
```

### Delete

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

##### Request

```MarkDown
DELETE https://<your-omain>/soffid/webservice/scim2/v1/CustomObject/1977187
```

##### 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>