# Fergus

> Manage Fergus jobs, customers, sites, contacts, enquiries and tasks, and read quotes and customer invoices.

App · 30 actions. Web page: https://docs.lodol.com/docs/integrations/fergus

## Actions

### Archive a job

Archive a job.

**Inputs**

- Job (`job_id`, number, required): The job.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {}
}
```

### Archive a site

Archive a site.

**Inputs**

- Site (`site_id`, number, required): The site.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {}
}
```

### Complete a task

Mark a task as completed.

**Inputs**

- Task (`task_id`, number, required): The task.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "assignedEmployeeIds": [],
      "completedAt": "example",
      "completedById": 1.0,
      "createdAt": "example",
      "createdById": 1.0,
      "description": "example",
      "dueDate": "example",
      "id": 1.0,
      "jobId": 1.0,
      "links": [],
      "status": "pending"
    },
    "result": "example"
  }
}
```

### Create a contact

Add a contact to a customer or a site.

**Inputs**

- Contact type (`contact_type`, text, required): Whether the contact belongs to a customer or a site. One of: `CUSTOMER`, `SITE`.
- Customer (`customer_id`, number): The customer the contact belongs to.
- Site (`site_id`, number): The site the contact belongs to.
- First name (`first_name`, text, required): The contact's first name.
- Last name (`last_name`, text): The contact's last name.
- Position (`position`, text): The contact's position, such as `Office manager`.
- Email (`email`, text): The contact's email address.
- Phone (`phone`, text): The contact's phone number.
- Mobile (`mobile`, text): The contact's mobile number.
- Company (`company`, text): The company the contact works for.
- Is main (`is_main`, true/false): Make this the main contact.
- Is billing (`is_billing`, true/false): Make this the billing contact.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "company": "example",
      "contactItems": [],
      "contactType": "CUSTOMER",
      "createdAt": "example",
      "customerId": 1.0,
      "firstName": "example",
      "id": 1.0,
      "isBilling": false,
      "isMain": false,
      "lastName": "example",
      "links": [],
      "modifiedAt": "example",
      "position": "example",
      "siteId": 1.0
    },
    "result": "example"
  }
}
```

### Create a customer

Create a customer with a main contact and, optionally, their address.

**Inputs**

- Customer full name (`customer_full_name`, text, required): The customer's full name, as a person or a business.
- First name (`first_name`, text, required): The contact's first name.
- Last name (`last_name`, text): The contact's last name.
- Position (`position`, text): The contact's position, such as `Office manager`.
- Email (`email`, text): The contact's email address.
- Phone (`phone`, text): The contact's phone number.
- Mobile (`mobile`, text): The contact's mobile number.
- Address line 1 (`physical_address1`, text): First line of the address.
- Address line 2 (`physical_address2`, text): Second line of the address.
- Suburb (`physical_suburb`, text): Suburb.
- City (`physical_city`, text): City.
- Region (`physical_region`, text): Region or state.
- Postcode (`physical_postcode`, text): Postcode.
- Country (`physical_country`, text): Country.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "billingContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "companyId": 1.0,
      "createdAt": "example",
      "customerFullName": "example",
      "customerSource": "example",
      "id": 1.0,
      "links": [],
      "mainContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "physicalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      },
      "postalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      },
      "pricingTier": {
        "createdAt": "example",
        "id": 1.0,
        "isDefault": false,
        "links": [],
        "markupRate": 1.0,
        "name": "example",
        "tierType": "example"
      }
    },
    "result": "example"
  }
}
```

### Create a job

Create a job. A job that isn't a draft needs a description, customer and site.

**Inputs**

- Job type (`job_type`, text, required): The kind of job. One of: `Quote`, `Estimate`, `Charge Up`.
- Title (`title`, text, required): The job's title.
- Is draft (`is_draft`, true/false): Create the job as a draft, which needs only a title.
- Description (`description`, text): What the job is for.
- Customer (`customer_id`, number): The customer the job is for.
- Site (`site_id`, number): The site where the work is done.
- Customer reference (`customer_reference`, text): The customer's order number.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "activeQuote": {
        "createdAt": "example",
        "declinedAt": "example",
        "description": "example",
        "dueDate": "example",
        "dueDays": "example",
        "guid": "example",
        "id": 1.0,
        "isAccepted": false,
        "isDraft": false,
        "isLocked": false,
        "isSent": false,
        "isSuperseded": false,
        "lastModified": "example",
        "publishedAt": "example",
        "quoteDate": "example",
        "title": "example",
        "total": 1.0,
        "versionNumber": 1.0,
        "voidedAt": "example"
      },
      "archived": false,
      "assignedGroups": [],
      "createdAt": "example",
      "customer": {
        "customerFullName": "example",
        "id": 1.0
      },
      "customerReference": "example",
      "description": "example",
      "id": 1.0,
      "jobNo": "example",
      "jobNumber": "example",
      "jobType": "example",
      "jobVariants": [],
      "lastModified": "example",
      "links": [],
      "longDescription": "example",
      "mainContact": {
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example"
      },
      "onHold": false,
      "parentJobId": 1.0,
      "siteAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "name": "example"
      },
      "status": "example"
    },
    "result": "example"
  }
}
```

### Create a site

Create a site with its default contact and address.

**Inputs**

- Name (`name`, text): The site's name.
- First name (`first_name`, text, required): The contact's first name.
- Last name (`last_name`, text): The contact's last name.
- Position (`position`, text): The contact's position, such as `Office manager`.
- Email (`email`, text): The contact's email address.
- Phone (`phone`, text): The contact's phone number.
- Mobile (`mobile`, text): The contact's mobile number.
- Address line 1 (`site_address1`, text, required): First line of the address.
- Address line 2 (`site_address2`, text): Second line of the address.
- Suburb (`site_suburb`, text): Suburb.
- City (`site_city`, text): City.
- Region (`site_region`, text): Region or state.
- Postcode (`site_postcode`, text): Postcode.
- Country (`site_country`, text): Country.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "billingContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "companyId": 1.0,
      "createdAt": "example",
      "defaultContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "deletedAt": "example",
      "id": 1.0,
      "isArchived": false,
      "links": [],
      "name": "example",
      "physicalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      },
      "postalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      }
    },
    "result": "example"
  }
}
```

### Create a task

Create a task, optionally linked to a job and assigned to people.

**Inputs**

- Description (`description`, text, required): What needs doing.
- Due date (`due_date`, date): The day the task is due.
- Job (`job_id`, number): The job to link the task to. It can't be changed later.
- Assigned to (`assigned_employee_ids`, list): The people to assign the task to.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "assignedEmployeeIds": [],
      "completedAt": "example",
      "completedById": 1.0,
      "createdAt": "example",
      "createdById": 1.0,
      "description": "example",
      "dueDate": "example",
      "id": 1.0,
      "jobId": 1.0,
      "links": [],
      "status": "pending"
    },
    "result": "example"
  }
}
```

### Create an enquiry

Record a new enquiry (a lead), such as from a website form.

**Inputs**

- Name (`name`, text, required): The name of the person or business enquiring.
- Description (`description`, text, required): What they're asking for.
- Source (`source`, text, required): Where the enquiry came from, such as `Website`.
- Email (`email`, text): Their email address.
- Phone number (`phone_number`, text): Their phone number.
- Address line 1 (`address1`, text): First line of their address.
- Address line 2 (`address2`, text): Second line of their address.
- Suburb (`suburb`, text): Suburb.
- City (`city`, text): City.
- Region (`region`, text): Region or state.
- Postcode (`postcode`, text): Postcode.
- Country (`country`, text): Country.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "address1": "example",
      "address2": "example",
      "addressCity": "example",
      "addressCountry": "example",
      "addressPostcode": "example",
      "addressRegion": "example",
      "addressSuburb": "example",
      "contactName": "example",
      "createdAt": "example",
      "description": "example",
      "id": 1.0,
      "links": [],
      "name": "example",
      "source": "example",
      "status": "example"
    },
    "result": "example"
  }
}
```

### Delete a customer

Delete a customer.

**Inputs**

- Customer (`customer_id`, number, required): The customer.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {}
}
```

### Delete a task

Delete a task.

**Inputs**

- Task (`task_id`, number, required): The task.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {}
}
```

### Get a contact

Get one contact.

**Inputs**

- Contact (`contact_id`, number, required): The contact.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "company": "example",
      "contactItems": [],
      "contactType": "CUSTOMER",
      "createdAt": "example",
      "customerId": 1.0,
      "firstName": "example",
      "id": 1.0,
      "isBilling": false,
      "isMain": false,
      "lastName": "example",
      "links": [],
      "modifiedAt": "example",
      "position": "example",
      "siteId": 1.0
    },
    "result": "example"
  }
}
```

### Get a customer

Get one customer with their contacts and addresses.

**Inputs**

- Customer (`customer_id`, number, required): The customer.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "billingContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "companyId": 1.0,
      "createdAt": "example",
      "customerFullName": "example",
      "customerSource": "example",
      "id": 1.0,
      "links": [],
      "mainContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "physicalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      },
      "postalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      },
      "pricingTier": {
        "createdAt": "example",
        "id": 1.0,
        "isDefault": false,
        "links": [],
        "markupRate": 1.0,
        "name": "example",
        "tierType": "example"
      }
    },
    "result": "example"
  }
}
```

### Get a customer invoice

Get one customer invoice with its totals and payment state.

**Inputs**

- Invoice (`invoice_id`, number, required): The invoice.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "attn": "example",
      "createdAt": "example",
      "customer": {
        "customerFullName": "example",
        "id": 1.0,
        "links": []
      },
      "customerId": 1.0,
      "description": "example",
      "directDebitStatus": "example",
      "dueDate": "example",
      "dueDays": {},
      "fergusPayEnabled": false,
      "id": 1.0,
      "invoiceDate": "example",
      "invoiceNumber": "example",
      "isFinal": false,
      "isSent": false,
      "jobId": 1.0,
      "links": [],
      "paidAt": "example",
      "receiverEmail": "example",
      "receiverFullName": "example",
      "receiverPostalAddress": "example",
      "sections": [],
      "status": "unpaid",
      "subtotal": 1.0,
      "taxRate": 1.0,
      "taxValue": 1.0,
      "title": "example",
      "totalPaid": 1.0,
      "type": "approved"
    },
    "result": "example"
  }
}
```

### Get a job

Get one job with its customer, site, main contact and active quote.

**Inputs**

- Job (`job_id`, number, required): The job.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "activeQuote": {
        "createdAt": "example",
        "declinedAt": "example",
        "description": "example",
        "dueDate": "example",
        "dueDays": "example",
        "guid": "example",
        "id": 1.0,
        "isAccepted": false,
        "isDraft": false,
        "isLocked": false,
        "isSent": false,
        "isSuperseded": false,
        "lastModified": "example",
        "publishedAt": "example",
        "quoteDate": "example",
        "title": "example",
        "total": 1.0,
        "versionNumber": 1.0,
        "voidedAt": "example"
      },
      "archived": false,
      "assignedGroups": [],
      "createdAt": "example",
      "customer": {
        "customerFullName": "example",
        "id": 1.0
      },
      "customerReference": "example",
      "description": "example",
      "id": 1.0,
      "jobNo": "example",
      "jobNumber": "example",
      "jobType": "example",
      "jobVariants": [],
      "lastModified": "example",
      "links": [],
      "longDescription": "example",
      "mainContact": {
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example"
      },
      "onHold": false,
      "parentJobId": 1.0,
      "siteAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "name": "example"
      },
      "status": "example"
    },
    "result": "example"
  }
}
```

### Get a quote

Get one quote with its sections, totals and status.

**Inputs**

- Quote (`quote_id`, number, required): The quote.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "acceptedAt": "example",
      "acceptedBy": "example",
      "attn": "example",
      "createdAt": "example",
      "declinedAt": "example",
      "deposit": {
        "invoiceGuid": "example",
        "invoiceUrl": "example",
        "isPaid": false,
        "optionType": "example",
        "optionValue": 1.0
      },
      "description": "example",
      "dueDate": "example",
      "dueDays": "example",
      "footerText": "example",
      "guid": "example",
      "id": 1.0,
      "isAccepted": false,
      "isDraft": false,
      "isLocked": false,
      "isSent": false,
      "isSuperseded": false,
      "jobId": 1.0,
      "jobNo": 1,
      "lastModified": "example",
      "links": [],
      "publishedAt": "example",
      "quoteConfig": {
        "accentColour": "example",
        "fontColour": "example",
        "fontSizeOverride": "example",
        "indentCustomerAddress": false,
        "mainColour": "example",
        "orientation": "example",
        "showAllLineItems": false,
        "showDocumentTotals": false,
        "showLabourPrices": false,
        "showLabourSummary": false,
        "showLineItemPrices": false,
        "showLineItemQuantities": false,
        "showLineItemTotals": false,
        "showMaterialPrices": false,
        "showMaterialSummary": false,
        "showSectionTotals": false
      },
      "quoteDate": "example",
      "receiverFullName": "example",
      "receiverPostalAddress": "example",
      "sections": [],
      "title": "example",
      "totals": {
        "discount": 1.0,
        "discountedSubTotal": 1.0,
        "gst": 1.0,
        "subTotal": 1.0,
        "total": 1.0
      },
      "versionNumber": 1.0,
      "voidedAt": "example"
    },
    "result": "example"
  }
}
```

### Get a site

Get one site with its contacts and address.

**Inputs**

- Site (`site_id`, number, required): The site.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "billingContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "companyId": 1.0,
      "createdAt": "example",
      "defaultContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "deletedAt": "example",
      "id": 1.0,
      "isArchived": false,
      "links": [],
      "name": "example",
      "physicalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      },
      "postalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      }
    },
    "result": "example"
  }
}
```

### List contacts

List customer and site contacts.

**Inputs**

- Contact type (`contact_type`, text): Only customer contacts or only site contacts. One of: `CUSTOMER`, `SITE`.
- Customer (`customer_id`, number): Only contacts of this customer.
- Site (`site_id`, number): Only contacts of this site.
- Search (`search`, text): Text to find in the contact's name, email or phone number.
- Sort field (`sort_field`, text): Field to sort by. One of: `firstName`, `lastName`, `createdAt`.
- Page size (`page_size`, number): Records per page, up to 100. Fergus returns 10 when left empty. From 1 to 100.
- Page cursor (`page_cursor`, text): The page to fetch, from the previous page's next link. Leave empty for the first page.
- Sort order (`sort_order`, text): Sort ascending (the default) or descending. One of: `asc`, `desc`.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": [],
    "paging": {
      "links": {
        "next": "example",
        "previous": "example",
        "self": "example"
      },
      "pageCount": 1.0,
      "perPage": 1.0
    },
    "result": "example"
  }
}
```

### List customer invoices

List customer invoices, filtered by customer, job, number or due date.

**Inputs**

- Customer (`customer_id`, number): Only invoices for this customer.
- Job (`job_id`, number): Only invoices for this job.
- Invoice number (`invoice_number`, text): Text to find in the invoice number.
- Due after (`due_after`, date and time): Only invoices due after this time.
- Due before (`due_before`, date and time): Only invoices due before this time.
- Sort field (`sort_field`, text): Field to sort by. One of: `id`, `createdAt`, `dueDate`.
- Page size (`page_size`, number): Records per page, up to 100. Fergus returns 10 when left empty. From 1 to 100.
- Page cursor (`page_cursor`, text): The page to fetch, from the previous page's next link. Leave empty for the first page.
- Sort order (`sort_order`, text): Sort ascending (the default) or descending. One of: `asc`, `desc`.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": [],
    "paging": {
      "links": {
        "next": "example",
        "previous": "example",
        "self": "example"
      },
      "pageCount": 1.0,
      "perPage": 1.0
    },
    "result": "example"
  }
}
```

### List customers

List customers, optionally matching a search.

**Inputs**

- Search (`search`, text): Text to find in the customer's name or main contact.
- Sort field (`sort_field`, text): Field to sort by. One of: `name`, `createdAt`.
- Page size (`page_size`, number): Records per page, up to 100. Fergus returns 10 when left empty. From 1 to 100.
- Page cursor (`page_cursor`, text): The page to fetch, from the previous page's next link. Leave empty for the first page.
- Sort order (`sort_order`, text): Sort ascending (the default) or descending. One of: `asc`, `desc`.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": [],
    "paging": {
      "links": {
        "next": "example",
        "previous": "example",
        "self": "example"
      },
      "pageCount": 1.0,
      "perPage": 1.0
    },
    "result": "example"
  }
}
```

### List jobs

List jobs, filtered by status, type, customer, site or a search.

**Inputs**

- Status (`status`, text): Only jobs with this status. One of: `Active`, `Completed`, `Estimate Rejected`, `Estimate Sent`, `Inactive`, `Quote Sent`, `Quote Rejected`, `To Price`.
- Job type (`job_type`, text): Only jobs of this type. One of: `Quote`, `Estimate`, `Charge Up`.
- Customer (`customer_id`, number): Only jobs for this customer.
- Site (`site_id`, number): Only jobs at this site.
- Job number (`job_number`, text): Only the job with this job number.
- Customer reference (`customer_reference`, text): Only jobs whose customer order number is exactly this.
- Search (`search`, text): Text to find in the job's description, number, customer name or site address.
- Show on hold (`show_on_hold`, true/false): Include jobs on hold.
- Show archived (`show_archived`, true/false): Include archived jobs.
- Sort field (`sort_field`, text): Field to sort by. One of: `jobNo`, `createdAt`, `lastModified`.
- Page size (`page_size`, number): Records per page, up to 100. Fergus returns 10 when left empty. From 1 to 100.
- Page cursor (`page_cursor`, text): The page to fetch, from the previous page's next link. Leave empty for the first page.
- Sort order (`sort_order`, text): Sort ascending (the default) or descending. One of: `asc`, `desc`.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": [],
    "paging": {
      "links": {
        "next": "example",
        "previous": "example",
        "self": "example"
      },
      "pageCount": 1.0,
      "perPage": 1.0
    },
    "result": "example"
  }
}
```

### List quotes

List quotes across all jobs, filtered by status or when they were created or changed.

**Inputs**

- Status (`status`, text): Only quotes with this status. One of: `draft`, `accepted`, `voided`, `superseded`, `declined`, `published`, `emailSent`, `emailNotSent`.
- Created after (`created_after`, date and time): Only quotes created after this time.
- Modified after (`modified_after`, date and time): Only quotes changed after this time.
- Sort field (`sort_field`, text): Field to sort by. One of: `id`, `createdAt`, `lastModified`.
- Page size (`page_size`, number): Records per page, up to 100. Fergus returns 10 when left empty. From 1 to 100.
- Page cursor (`page_cursor`, text): The page to fetch, from the previous page's next link. Leave empty for the first page.
- Sort order (`sort_order`, text): Sort ascending (the default) or descending. One of: `asc`, `desc`.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": [],
    "paging": {
      "links": {
        "next": "example",
        "previous": "example",
        "self": "example"
      },
      "pageCount": 1.0,
      "perPage": 1.0
    },
    "result": "example"
  }
}
```

### List sites

List sites (the places where work is done), filtered by name, city, postcode or a search.

**Inputs**

- Name (`name`, text): Only sites with this name.
- City (`city`, text): Only sites in this city.
- Postcode (`postcode`, text): Only sites with this postcode.
- Search (`search`, text): Text to find in the site's name, contacts or address.
- Sort field (`sort_field`, text): Field to sort by. One of: `name`, `createdAt`.
- Page size (`page_size`, number): Records per page, up to 100. Fergus returns 10 when left empty. From 1 to 100.
- Page cursor (`page_cursor`, text): The page to fetch, from the previous page's next link. Leave empty for the first page.
- Sort order (`sort_order`, text): Sort ascending (the default) or descending. One of: `asc`, `desc`.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": [],
    "paging": {
      "links": {
        "next": "example",
        "previous": "example",
        "self": "example"
      },
      "pageCount": 1.0,
      "perPage": 1.0
    },
    "result": "example"
  }
}
```

### List tasks

List tasks, filtered by status, assignee, job or due date.

**Inputs**

- Status (`status`, text): Only tasks with this status. One of: `pending`, `completed`.
- Assigned to (`employee_id`, number): Only tasks assigned to this person.
- Job (`job_id`, number): Only tasks linked to this job.
- Due from (`due_from`, date): Only tasks due on or after this day.
- Due to (`due_to`, date): Only tasks due on or before this day.
- Overdue (`overdue`, true/false): Only tasks past their due date and not completed.
- Sort field (`sort_field`, text): Field to sort by. One of: `createdAt`, `dueDate`.
- Page size (`page_size`, number): Records per page, up to 100. Fergus returns 10 when left empty. From 1 to 100.
- Page cursor (`page_cursor`, text): The page to fetch, from the previous page's next link. Leave empty for the first page.
- Sort order (`sort_order`, text): Sort ascending (the default) or descending. One of: `asc`, `desc`.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": [],
    "paging": {
      "links": {
        "next": "example",
        "previous": "example",
        "self": "example"
      },
      "pageCount": 1.0,
      "perPage": 1.0
    },
    "result": "example"
  }
}
```

### List users

List the people in your Fergus company.

**Inputs**

- User type (`user_type`, text): Only users of this type. One of: `contractor`, `time_sheet_only` (Time sheet only), `field_worker` (Field worker), `apprentice`, `tradesman`, `advisor`, `full_user` (Full user).
- Status (`status`, text): Only users with this status. One of: `active`, `disabled`, `invited`.
- Search (`search`, text): Text to find in the user's name, username, email or address.
- Sort field (`sort_field`, text): Field to sort by. One of: `firstName`, `lastName`, `createdAt`.
- Page size (`page_size`, number): Records per page, up to 100. Fergus returns 10 when left empty. From 1 to 100.
- Page cursor (`page_cursor`, text): The page to fetch, from the previous page's next link. Leave empty for the first page.
- Sort order (`sort_order`, text): Sort ascending (the default) or descending. One of: `asc`, `desc`.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": [],
    "paging": {
      "links": {
        "next": "example",
        "previous": "example",
        "self": "example"
      },
      "pageCount": 1.0,
      "perPage": 1.0
    },
    "result": "example"
  }
}
```

### Update a contact

Change a contact's name, position, email or phone numbers. Fields left empty keep their current values.

**Inputs**

- Contact (`contact_id`, number, required): The contact.
- First name (`first_name`, text): The contact's first name.
- Last name (`last_name`, text): The contact's last name.
- Position (`position`, text): The contact's position, such as `Office manager`.
- Email (`email`, text): The contact's email address.
- Phone (`phone`, text): The contact's phone number.
- Mobile (`mobile`, text): The contact's mobile number.
- Company (`company`, text): The company the contact works for.
- Is main (`is_main`, true/false): Make this the main contact.
- Is billing (`is_billing`, true/false): Make this the billing contact.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "company": "example",
      "contactItems": [],
      "contactType": "CUSTOMER",
      "createdAt": "example",
      "customerId": 1.0,
      "firstName": "example",
      "id": 1.0,
      "isBilling": false,
      "isMain": false,
      "lastName": "example",
      "links": [],
      "modifiedAt": "example",
      "position": "example",
      "siteId": 1.0
    },
    "result": "example"
  }
}
```

### Update a customer

Change a customer's name, main contact or address. Fields left empty keep their current values.

**Inputs**

- Customer (`customer_id`, number, required): The customer.
- Customer full name (`customer_full_name`, text): The customer's full name.
- First name (`first_name`, text): The contact's first name.
- Last name (`last_name`, text): The contact's last name.
- Position (`position`, text): The contact's position, such as `Office manager`.
- Email (`email`, text): The contact's email address.
- Phone (`phone`, text): The contact's phone number.
- Mobile (`mobile`, text): The contact's mobile number.
- Address line 1 (`physical_address1`, text): First line of the address.
- Address line 2 (`physical_address2`, text): Second line of the address.
- Suburb (`physical_suburb`, text): Suburb.
- City (`physical_city`, text): City.
- Region (`physical_region`, text): Region or state.
- Postcode (`physical_postcode`, text): Postcode.
- Country (`physical_country`, text): Country.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "billingContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "companyId": 1.0,
      "createdAt": "example",
      "customerFullName": "example",
      "customerSource": "example",
      "id": 1.0,
      "links": [],
      "mainContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "physicalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      },
      "postalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      },
      "pricingTier": {
        "createdAt": "example",
        "id": 1.0,
        "isDefault": false,
        "links": [],
        "markupRate": 1.0,
        "name": "example",
        "tierType": "example"
      }
    },
    "result": "example"
  }
}
```

### Update a job

Change a job's title, description, customer, site or customer order number.

**Inputs**

- Job (`job_id`, number, required): The job.
- Title (`title`, text): The job's title.
- Description (`description`, text): What the job is for.
- Customer (`customer_id`, number): The customer the job is for.
- Site (`site_id`, number): The site where the work is done.
- Customer reference (`customer_reference`, text): The customer's order number.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "activeQuote": {
        "createdAt": "example",
        "declinedAt": "example",
        "description": "example",
        "dueDate": "example",
        "dueDays": "example",
        "guid": "example",
        "id": 1.0,
        "isAccepted": false,
        "isDraft": false,
        "isLocked": false,
        "isSent": false,
        "isSuperseded": false,
        "lastModified": "example",
        "publishedAt": "example",
        "quoteDate": "example",
        "title": "example",
        "total": 1.0,
        "versionNumber": 1.0,
        "voidedAt": "example"
      },
      "archived": false,
      "assignedGroups": [],
      "createdAt": "example",
      "customer": {
        "customerFullName": "example",
        "id": 1.0
      },
      "customerReference": "example",
      "description": "example",
      "id": 1.0,
      "jobNo": "example",
      "jobNumber": "example",
      "jobType": "example",
      "jobVariants": [],
      "lastModified": "example",
      "links": [],
      "longDescription": "example",
      "mainContact": {
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example"
      },
      "onHold": false,
      "parentJobId": 1.0,
      "siteAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "name": "example"
      },
      "status": "example"
    },
    "result": "example"
  }
}
```

### Update a site

Change a site's name or address. Fields left empty keep their current values.

**Inputs**

- Site (`site_id`, number, required): The site.
- Name (`name`, text): The site's name.
- Address line 1 (`site_address1`, text): First line of the address.
- Address line 2 (`site_address2`, text): Second line of the address.
- Suburb (`site_suburb`, text): Suburb.
- City (`site_city`, text): City.
- Region (`site_region`, text): Region or state.
- Postcode (`site_postcode`, text): Postcode.
- Country (`site_country`, text): Country.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "billingContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "companyId": 1.0,
      "createdAt": "example",
      "defaultContact": {
        "company": "example",
        "contactItems": [],
        "firstName": "example",
        "id": 1.0,
        "lastName": "example",
        "position": "example"
      },
      "deletedAt": "example",
      "id": 1.0,
      "isArchived": false,
      "links": [],
      "name": "example",
      "physicalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      },
      "postalAddress": {
        "address1": "example",
        "address2": "example",
        "addressCity": "example",
        "addressCountry": "example",
        "addressPostcode": "example",
        "addressRegion": "example",
        "addressSuburb": "example",
        "id": 1.0
      }
    },
    "result": "example"
  }
}
```

### Update a task

Change a task's description, due date or assignees. Assignees you give replace the current ones.

**Inputs**

- Task (`task_id`, number, required): The task.
- Description (`description`, text): What needs doing.
- Due date (`due_date`, date): The day the task is due.
- Assigned to (`assigned_employee_ids`, list): The people to assign the task to, replacing the current ones.

**Outputs**

- `data` (object): The response from Fergus.

**Example output**

```json
{
  "data": {
    "data": {
      "assignedEmployeeIds": [],
      "completedAt": "example",
      "completedById": 1.0,
      "createdAt": "example",
      "createdById": 1.0,
      "description": "example",
      "dueDate": "example",
      "id": 1.0,
      "jobId": 1.0,
      "links": [],
      "status": "pending"
    },
    "result": "example"
  }
}
```
