

# Reading from Freshdesk entities
<a name="freshdesk-reading-from-entities"></a>

**Prerequisite**

A Freshdesk object you would like to read from. You will need the object name.

**Supported entities for Sync source**:


| Entity | Can be filtered | Supports limit | Supports Order by | Supports Select \$1 | Supports partitioning | 
| --- | --- | --- | --- | --- | --- | 
| Agents | Yes | Yes | No | Yes | Yes | 
| Business Hours | No | Yes | No | Yes | Yes | 
| Company | Yes | Yes | No | Yes | Yes | 
| Contacts | Yes | Yes | No | Yes | Yes | 
| Conversations | No | Yes | No | Yes | No | 
| Email Configs | No | Yes | No | Yes | No | 
| Email Inboxes | Yes | Yes | Yes | Yes | No | 
| Forum Categories | No | Yes | No | Yes | No | 
| Forums | No | Yes | No | Yes | No | 
| Groups | No | Yes | No | Yes | No | 
| Products | No | Yes | No | Yes | No | 
| Roles | No | Yes | No | Yes | No | 
| Satisfaction Ratings | Yes | Yes | No | Yes | No | 
| Skills | No | Yes | No | Yes | No | 
| Solutions | Yes | Yes | No | Yes | No | 
| Surveys | No | Yes | No | Yes | No | 
| Tickets | Yes | Yes | Yes | Yes | Yes | 
| Time Entries | Yes | Yes | No | Yes | No | 
| Topics | No | Yes | No | Yes | No | 
| Topic Comments | No | Yes | No | Yes | No | 

**Supported entities for Async source**:


| Entity | API version | Can be filtered | Supports limit | Supports Order by | Supports Select \$1 | Supports partitioning | 
| --- | --- | --- | --- | --- | --- | --- | 
| Companies | v2 | No | No | No | No | No | 
| Contacts | v2 | No | No | No | No | No | 

**Example**:

```
freshdesk_read = glueContext.create_dynamic_frame.from_options(
    connection_type="freshdesk",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "entityName",
        "API_VERSION": "v2"
    }
```

**Freshdesk entity and field details**:


| Entity | Field | 
| --- | --- | 
| Agents | https://developers.freshdesk.com/api/\$1list\$1all\$1agents | 
| Business-hours | https://developers.freshdesk.com/api/\$1list\$1all\$1business\$1hours | 
| Comments | https://developers.freshdesk.com/api/\$1comment\$1attributess | 
| Company | https://developers.freshdesk.com/api/\$1companies | 
| Contacts | https://developers.freshdesk.com/api/\$1list\$1all\$1contacts | 
| Conversations | https://developers.freshdesk.com/api/\$1list\$1all\$1ticket\$1notes | 
| Email-configs | https://developers.freshdesk.com/api/\$1list\$1all\$1email\$1configs | 
| Email-inboxes | https://developers.freshdesk.com/api/\$1list\$1all\$1email\$1mailboxes | 
| Forum-categories | https://developers.freshdesk.com/api/\$1category\$1attributes | 
| Forums | https://developers.freshdesk.com/api/\$1forum\$1attributes | 
| Groups | https://developers.freshdesk.com/api/\$1list\$1all\$1groups | 
| Products | https://developers.freshdesk.com/api/\$1list\$1all\$1products | 
| Roles | https://developers.freshdesk.com/api/\$1list\$1all\$1roles | 
| Satisfaction-rating | https://developers.freshdesk.com/api/\$1view\$1all\$1satisfaction\$1ratingss | 
| Skills | https://developers.freshdesk.com/api/\$1list\$1all\$1skills | 
| Solutions | https://developers.freshdesk.com/api/\$1solution\$1content | 
| Surveys | https://developers.freshdesk.com/api/\$1list\$1all\$1survey | 
| Tickets | https://developers.freshdesk.com/api/\$1list\$1all\$1tickets | 
| Time-entries | https://developers.freshdesk.com/api/\$1list\$1all\$1time\$1entries | 
| Topics | https://developers.freshdesk.com/api/\$1topic\$1attributes | 

## Partitioning queries
<a name="freshdesk-reading-partitioning-queries"></a>

**Filter-based partitioning**:

You can provide the additional Spark options `PARTITION_FIELD`, `LOWER_BOUND`, `UPPER_BOUND`, and `NUM_PARTITIONS` if you want to utilize concurrency in Spark. With these parameters, the original query would be split into `NUM_PARTITIONS` number of sub-queries that can be executed by Spark tasks concurrently.
+ `PARTITION_FIELD`: the name of the field to be used to partition the query.
+ `LOWER_BOUND`: an **inclusive** lower bound value of the chosen partition field.

  For the Datetime field, we accept the Spark timestamp format used in Spark SQL queries.

  Examples of valid value:

  ```
  "2024-09-30T01:01:01.000Z"
  ```
+ `UPPER_BOUND`: an **exclusive** upper bound value of the chosen partition field.
+ `NUM_PARTITIONS`: the number of partitions.

Example:

```
freshDesk_read = glueContext.create_dynamic_frame.from_options(
     connection_type="freshdesk",
     connection_options={
         "connectionName": "connectionName",
         "ENTITY_NAME": "entityName",
         "API_VERSION": "v2",
         "PARTITION_FIELD": "Created_Time"
         "LOWER_BOUND": " 2024-10-27T23:16:08Z“
         "UPPER_BOUND": " 2024-10-27T23:16:08Z"
         "NUM_PARTITIONS": "10"
     }
```