# PutZendeskTicket

### Description

The processor uses the Zendesk API to ingest tickets into Zendesk. The processor is capable to send requests directly from the FlowFile content or construct the request objects from the incoming records using a RecordReader.

### Authentication

Zendesk API uses basic authentication. Either a password or an authentication token has to be provided. In Zendesk API Settings, it's possible to generate authentication tokens, eliminating the need for users to expose their passwords. This approach also offers the advantage of fast token revocation when required.

### Property values

There are multiple ways of providing property values to the request object:

Record Path:

  The property value is going to be evaluated as a record path if the value is provided inside brackets starting with a '%'.

  Example:

  The incoming record look like this.

                                  {
                                     "record":{
                                        "description":"This is a sample description.",
                                        "issue_type":"Immediate",
                                        "issue":{
                                           "name":"General error",
                                           "type":"Immediate"
                                        },
                                        "project":{
                                           "name":"Maintenance"
                                        }
                                     }
                                  }

  We are going to provide Record Path values for the Comment Body, Subject, Priority and Type processor attributes:

                                  Comment Body : %{/record/description}
                                  Subject : %{/record/issue/name}
                                  Priority : %{/record/issue/type}
                                  Type : %{/record/project/name}

  The constructed request object that is going to be sent to the Zendesk API will look like this:

                                  {
                                     "comment":{
                                        "body":"This is a sample description."
                                     },
                                     "subject":"General error",
                                     "priority":"Immediate",
                                     "type":"Maintenance"
                                  }

Constant:

  The property value is going to be treated as a constant if the provided value doesn't match with the Record Path format.

  Example:

  We are going to provide constant values for the Comment Body, Subject, Priority and Type processor attributes:

                                  Comment Body : Sample description
                                  Subject : Sample subject
                                  Priority : High
                                  Type : Sample type

  The constructed request object that is going to be sent to the Zendesk API will look like this:

                                  {
                                     "comment":{
                                        "body":"Sample description"
                                     },
                                     "subject":"Sample subject",
                                     "priority":"High",
                                     "type":"Sample type"
                                  }

### Additional properties

The processor offers a set of frequently used Zendesk ticket attributes within its property list. However, users have the flexibility to include any desired number of additional properties using dynamic properties. These dynamic properties utilize their keys as Json Pointer, which denote the paths within the request object. Correspondingly, the values of these dynamic properties align with the predefined property attributes. The possible Zendesk request attributes can be found in the Zendesk API documentation

Property Key values:

The dynamic property key must be a valid Json Pointer value which has the following syntax rules:

- The path starts with /.
- Each segment is separated by /.
- Each segment can be interpreted as either an array index or an object key.

Example:

We are going to add a new dynamic property to the processor:

                    /request/new_object : This is a new property
                    /request/new_array/0 : This is a new array element

The constructed request object will look like this:

                    {
                       "request":{
                          "new_object":"This is a new property",
                          "new_array":[
                             "This is a new array element"
                          ]
                       }
                    }