# Listing Mutation

{% hint style="info" %}
Mutations are responsible to update a specific operations like activating, deactivating listing or archiving or unarchiving listing.
{% endhint %}

```typescript
type Mutation {
  updateListing(listing: ListingInput): Listing
}
```

Here are details on the capabilities of different mutations

* `updateListing`: Is used to perform update on an listing with the help of a listing Id, this will help is performing some basic operations listed below

### Schema Definition

```graphql
input ListingInput {
  id: String!
  action: LISTING_ACTIONS!
}

enum LISTING_ACTIONS {
  ACTIVATE_LISTING
  DEACTIVATE_LISTING
  ARCHIVE_LISTING
  UNARCHIVE_LISTING
}
```

Below we are providing a full example how to  update listing, all this information is not required, only the ones that was using **!** notation previously.

{% tabs %}
{% tab title="graphQL" %}

```graphql

mutation {
  updateListing(
    listing: {
      id: "42b751a6-3eb6-4e48-a0d1-8e9959151672"
      action: ACTIVATE_LISTING
    }
  ) {
    id
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl --location --request POST 'http://<subdomain>.everreal.co/api/reporting/graphql' \
--header 'Authorization: Bearer ....' \
--header 'Content-Type: application/json' \
--header 'Cookie: accept-language=de-DE' \
--data-raw '{"query":"\r\nmutation {\r\n  updateListing(\r\n    listing: {\r\n      id: \"42b751a6-3eb6-4e48-a0d1-8e9959151672\"\r\n      action: ACTIVATE_LISTING\r\n    }\r\n  ) {\r\n    id\r\n  }\r\n}","variables":{}}'
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer ....");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "accept-language=de-DE");

var graphql = JSON.stringify({
  query: "\r\nmutation {\r\n  updateListing(\r\n    listing: {\r\n      id: \"42b751a6-3eb6-4e48-a0d1-8e9959151670\"\r\n      action: ACTIVATE_LISTING\r\n    }\r\n  ) {\r\n    id\r\n  }\r\n}",
  variables: {}
})
var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: graphql,
  redirect: 'follow'
};

fetch("http://<subdomain>.everreal.co/api/reporting/graphql", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));j
```

{% endtab %}
{% endtabs %}
