# Update icon mapping

- Operation ID: `updateIconById`
- HTTP method: `POST`
- Path: `/activities-api/icons/{iconID}`
- [Human-readable API reference](https://hub.synerise.com/api-reference/data-management#tag/Activities/operation/updateIconById)

## 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:
  /activities-api/icons/{iconID}:
    post:
      tags:
        - Activities
      summary: Update icon mapping
      description: |
        Modify an existing icon mapping

        ---

        **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=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>

        **API key permission required:** `ACTIVITIES_API_ACTIVITIES_UPDATE`

        **User role permission required:** `client_activities: update`
      operationId: updateIconById
      security:
        - JWT: []
      parameters:
        - in: path
          name: iconID
          description: ID of the icon
          required: true
          schema:
            type: number
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: Details of the icon mapping
              required:
                - action
                - icons
              properties:
                action:
                  type: string
                  example: page.visit
                  description: "Action name. Can be up to 32 characters long and must match the following regular expression: `^[a-zA-Z0-9\\.\\-_]+$`"
                icons:
                  type: object
                  description: Icon configuration with primary, secondary icon and color
                  required:
                    - primary
                  properties:
                    primary:
                      type: string
                      description: Primary icon ID/name from the system SVG library
                    secondary:
                      type: string
                      nullable: true
                      description: Secondary icon ID/name from the system SVG library
                    color:
                      type: string
                      nullable: true
                      description: Semantic color name (e.g. positive, negative, warning, neutral) or hex color code
        description: Updated mapping data
        required: true
      responses:
        "200":
          description: Icon mapping
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  description: Details of the icon mapping
                  properties:
                    id:
                      type: number
                      description: ID of the mapping
                    businessProfileId:
                      type: number
                      description: Workspace where this mapping applies
                    action:
                      type: string
                      example: page.visit
                      description: "Action name. Can be up to 32 characters long and must match the following regular expression: `^[a-zA-Z0-9\\.\\-_]+$`"
                    icons:
                      type: object
                      description: Icon configuration with primary, secondary icon and color
                      required:
                        - primary
                      properties:
                        primary:
                          type: string
                          description: Primary icon ID/name from the system SVG library
                        secondary:
                          type: string
                          nullable: true
                          description: Secondary icon ID/name from the system SVG library
                        color:
                          type: string
                          nullable: true
                          description: Semantic color name (e.g. positive, negative, warning, neutral) or hex color code
      x-snr-doc-urls:
        - /api-reference/data-management#tag/Activities/operation/updateIconById
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/activities-api/icons/%7BiconID%7D \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"action":"page.visit","icons":{"primary":"string","secondary":"string","color":"string"}}'
        - lang: Python
          label: Python
          source: |-
            import http.client

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

            payload = "{\"action\":\"page.visit\",\"icons\":{\"primary\":\"string\",\"secondary\":\"string\",\"color\":\"string\"}}"

            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
                }

            conn.request("POST", "/activities-api/icons/%7BiconID%7D", payload, headers)

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

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "action": "page.visit",
              "icons": {
                "primary": "string",
                "secondary": "string",
                "color": "string"
              }
            });

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

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

            xhr.open("POST", "https://api.synerise.com/activities-api/icons/%7BiconID%7D");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");
            xhr.setRequestHeader("content-type", "application/json");

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

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/activities-api/icons/%7BiconID%7D",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN",
                "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({
              action: 'page.visit',
              icons: {primary: 'string', secondary: 'string', color: 'string'}
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/activities-api/icons/%7BiconID%7D');
            $request->setMethod(HTTP_METH_POST);

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

            $request->setBody('{"action":"page.visit","icons":{"primary":"string","secondary":"string","color":"string"}}');

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

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/activities-api/icons/%7BiconID%7D")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"action\":\"page.visit\",\"icons\":{\"primary\":\"string\",\"secondary\":\"string\",\"color\":\"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: Activities
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
