# Update directory

- Operation ID: `updateDirectory`
- HTTP method: `PATCH`
- Path: `/tags-collector/directories/{directoryHash}`
- [Human-readable API reference](https://hub.synerise.com/api-reference/data-management#tag/Asset-tags/operation/updateDirectory)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /tags-collector/directories/{directoryHash}:
    patch:
      tags:
        - Asset tags
      summary: Update directory
      description: |
        Updates a directory.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=authenticateUsingPOST_v3" target="_blank" rel="noopener">Profile (Client)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>

        **API key permission required:** `TAGS_COLLECTOR_DIRECTORY_UPDATE`

        **User role permission required:** `assets_tags: update`
      operationId: updateDirectory
      parameters:
        - in: path
          name: directoryHash
          description: Hash ID of the directory
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Name of the directory
                params:
                  type: object
                  description: Free-form parameters
                  additionalProperties:
                    anyOf:
                      - type: string
                      - type: number
                      - type: boolean
        description: ""
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                description: Information about the directory where the tag is assigned. Can be `null`.
                properties:
                  createdAt:
                    type: string
                    format: date-time
                    description: Creation time
                  hash:
                    type: string
                    description: HashID of the directory
                  name:
                    type: string
                    description: Name of the directory
                  params:
                    type: object
                    description: Free-form parameters
                    additionalProperties:
                      anyOf:
                        - type: string
                        - type: number
                        - type: boolean
                  type:
                    type: object
                    description: Details of the directory type
                    properties:
                      createdAt:
                        type: string
                        format: date-time
                        description: Creation time
                      hash:
                        type: string
                        description: HashID of the directory type
                      name:
                        type: string
                        description: Name of the directory type
        "204":
          description: No Content
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
      x-snr-doc-urls:
        - /api-reference/data-management#tag/Asset-tags/operation/updateDirectory
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request PATCH \
              --url https://api.synerise.com/tags-collector/directories/%7BdirectoryHash%7D \
              --header 'content-type: application/json' \
              --data '{"name":"string","params":{"property1":"string","property2":"string"}}'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "{\"name\":\"string\",\"params\":{\"property1\":\"string\",\"property2\":\"string\"}}"

            headers = { 'content-type': "application/json" }

            conn.request("PATCH", "/tags-collector/directories/%7BdirectoryHash%7D", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "name": "string",
              "params": {
                "property1": "string",
                "property2": "string"
              }
            });

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("PATCH", "https://api.synerise.com/tags-collector/directories/%7BdirectoryHash%7D");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "PATCH",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/tags-collector/directories/%7BdirectoryHash%7D",
              "headers": {
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({name: 'string', params: {property1: 'string', property2: 'string'}}));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            HttpRequest::methodRegister('PATCH');
            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/tags-collector/directories/%7BdirectoryHash%7D');
            $request->setMethod(HttpRequest::HTTP_METH_PATCH);

            $request->setHeaders([
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"name":"string","params":{"property1":"string","property2":"string"}}');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.patch("https://api.synerise.com/tags-collector/directories/%7BdirectoryHash%7D")
              .header("content-type", "application/json")
              .body("{\"name\":\"string\",\"params\":{\"property1\":\"string\",\"property2\":\"string\"}}")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Asset tags
```
