# Enquiries

## Get an Enquiry

<mark style="color:blue;">`GET`</mark> `https://api.tiny.plus/v2/enquiries/{{id}}`

This endpoint allows you to get a full Enquiry record.

#### Path Parameters

| Name | Type   | Description       |
| ---- | ------ | ----------------- |
| id   | number | ID of the enquiry |

#### Query Parameters

| Name          | Type    | Description                                                                                                                                                                                                                                                                                                             |
| ------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| with\_related | boolean | <p>Can be either <code>1</code> or <code>0</code>. Default is <code>1</code>. When passed, information about the related records to the requested record are also returned, in a <code>'related'</code> object.<br>If you don't need the related records, set this to <code>0</code> for a performance improvement.</p> |

#### Headers

| Name          | Type   | Description        |
| ------------- | ------ | ------------------ |
| Authorization | string | Your access token. |

{% tabs %}
{% tab title="200 Enquiry successfully retrieved." %}

```javascript
{
    "id": 1301
    "name": "New Project",
    "contact_name": "Adam Adamson",
    "contact_company": "Adamson Developments",
    "contact_email": "adam@adamson.com",
    "assigned_user": 1231,
    ...
}
```

{% endtab %}

{% tab title="404 Could not find a contact matching the provided ID." %}

```javascript
{
    "message": "Enquiry not found."
}
```

{% endtab %}
{% endtabs %}

#### Example Usage

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

```javascript
var settings = {
  "url": "https://api.tiny.plus/v2/enquiries/{{id}}",
  "method": "GET",
  "headers": {
    "Authorization": "{{user_access_token}}"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.tiny.plus/v2/enquiries/{{id}}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: {{user_access_token}}"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
} ?>
```

{% endtab %}
{% endtabs %}

## Create an Enquiry

<mark style="color:green;">`POST`</mark> `https://api.tiny.plus/v2/enquiries`

You can create a new tiny+ enquiry with this endpoint. The only required field to create an Enquiry in tiny+ is `name`, however we recommend you provide as much information as possible.&#x20;

#### Headers

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| Accepts       | string | Use `application/json` |
| Content-Type  | string | Use `application/json` |
| Authorization | string | Your access token.     |

#### Request Body

| Name        | Type   | Description                                                                                                                                                                                                                                                                                                                               |
| ----------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| JSON object | object | <p><code>{</code><br>    <code>"name": "New Project",</code><br>    <code>"assigned\_user": 27110,</code><br>    <code>"description": "A new aged care facility",</code><br>    <code>"contact\_name": "Andrew Xavier",</code><br>    <code>"contact\_company": "Xavier Developers"</code><br>    <code>....</code><br><code>}</code></p> |

{% tabs %}
{% tab title="200 A JSON object is returned with your new tiny+ record ID." %}

```
{
    id: [your new ID]
}
```

{% endtab %}

{% tab title="400 If there was a problem adding the record, you'll receive a 400 response." %}

```
{
    error: 'Error adding the record.'
}
```

{% endtab %}

{% tab title="403 If you do not have permission to add the record, you'll receive a 403 response." %}

```
```

{% endtab %}
{% endtabs %}

## Enquiries Field Reference

| Field            |                                  Type                                  | Details                                                                                                                                                                                                                                                              | Permission |
| ---------------- | :--------------------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------: |
| id               |                                 Number                                 | Unique record identifier.                                                                                                                                                                                                                                            |  Read-only |
| name             | <p>String (up to 200 characters).</p><p><strong>REQUIRED.</strong></p> | Identifying Name / Title.                                                                                                                                                                                                                                            |    Full    |
| description      |                                 String                                 | Description.                                                                                                                                                                                                                                                         |    Full    |
| created\_date    |                      String (YYYY-MM-DD hh:mm:ss)                      | Date record was first created.                                                                                                                                                                                                                                       |  Read-only |
| modified\_date   |                      String (YYYY-MM-DD hh:mm:ss)                      | Date record was last modified.                                                                                                                                                                                                                                       |  Read-only |
| created\_user    |                                 Number                                 | ID of user who made the record.                                                                                                                                                                                                                                      |  Read-only |
| modified\_user   |                                 Number                                 | ID of user who last edited the record.                                                                                                                                                                                                                               |  Read-only |
| assigned\_user   |                                 Number                                 | ID of assigned user.                                                                                                                                                                                                                                                 |    Full    |
| is\_synced       |                                 Boolean                                | Whether the record has been synced from another source.                                                                                                                                                                                                              |    Full    |
| sync\_origin     |                      String (up to 50 characters)                      | A simple string that you supply to let tiny+ users know where the record is synced from.                                                                                                                                                                             |    Full    |
| remote\_id       |                      String (up to 200 characters)                     | A remote identifier for this record.                                                                                                                                                                                                                                 |    Full    |
| record\_url      |                                 String                                 | The fully qualified URI of the record.                                                                                                                                                                                                                               |  Read-only |
| record\_status   |                 <p>String <br>(or ID for add/edit)</p>                 | The current status of this enquiry. Can be either `open` or `closed`. When adding/editing, you can pass a record\_phase ID here instead of the string if you have configured these.                                                                                  |    Full    |
| contact\_name    |                              String or ID                              | When reading, will display either a String if the contact has not been created separately in tiny+, or an ID of the primary related contact if they already exist in tiny+. When editing, you can provide a string, or provide an ID to link to an existing contact. |    Full    |
| contact\_company |                              String or ID                              | When reading, will display either a String if the company has not been created separately in tiny+, or an ID of the primary related company if they already exist in tiny+. When editing, you can provide a string, or provide an ID to link to an existing company. |    Full    |
| contact\_email   |                                 String                                 | The contact's email address.                                                                                                                                                                                                                                         |    Full    |
| contact\_phone   |                                 String                                 | The contact's phone number.                                                                                                                                                                                                                                          |    Full    |
| contact\_role    |                                 String                                 | The contact's role or position.                                                                                                                                                                                                                                      |    Full    |
| followup\_date   |                                  Date                                  | When the enquiry should be followed up. If left blank when adding a new enquiry, defaults to +2 business days.                                                                                                                                                       |    Full    |
| notes            |                                 String                                 | An extra area for notes.                                                                                                                                                                                                                                             |    Full    |
| location\_id     |                                 String                                 | A project's physical address. Will be parsed and geocoded after being added.                                                                                                                                                                                         |    Full    |
