Back to top

API Documentation (Sample)

The Meiosis Api provides full access to read, create, and manage your team’s data and configuration. This document serves as an example of interacting with our API.

The full API Documentation is available to all registered users at https://app.petrisuite.com/support/docs

Customers

Collections

When not dealing with a specified customer, you’ll want to use the customer collection endpoint.

Fetch Collection
GET/customers/{?per_page,page,email,custom_attribute_key}

Returns an array of customers (up to all customers) based on the filters passed in. If per_page is provided, paginated set will be returned, including metadata about the current page selected and total pages available.

Example URI

GET https://app.petrisuite.com/api/customers/?per_page=&page=&email=&custom_attribute_key=
URI Parameters
HideShow
email
string (optional) 

Search terms for filtering result set. While email is the example used here, you can also use first, middle, last, or organization_id

custom_attribute_key
string (optional) 

Search terms for filtering result set based on custom attributes that your team has created. Any custom attribute key can be used.

per_page
number (optional) Default: 25 

How many results you want per page. If omitted, all matching data will be returned

page
number (optional) Default: 1 
Request  Without Pagination
HideShow
Headers
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": "xxxxxx",
    "email": "[email protected]",
    "first": "John",
    "middle": "Stephen",
    "last": "Doe",
    "organization_id": "sdf34g3",
    "assigned_user": 562,
    "created_at": "2016-09-12 18:45:29",
    "updated_at": "2016-09-12 18:45:29"
  },
  {
    "id": "xxxxxx",
    "email": "[email protected]",
    "first": "John",
    "middle": "Stephen",
    "last": "Doe",
    "organization_id": "sdf34g3",
    "assigned_user": 562,
    "created_at": "2016-09-12 18:45:29",
    "updated_at": "2016-09-12 18:45:29"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}
Request  With Pagination
HideShow
Headers
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "meta": {
    "total": 250297,
    "current_page": 1,
    "total_pages": 50060
  },
  "customers": [
    {
      "id": "xxxxxx",
      "email": "[email protected]",
      "first": "John",
      "middle": "Stephen",
      "last": "Doe",
      "organization_id": "sdf34g3",
      "assigned_user": 562,
      "created_at": "2016-09-12 18:45:29",
      "updated_at": "2016-09-12 18:45:29"
    },
    {
      "id": "xxxxxx",
      "email": "[email protected]",
      "first": "John",
      "middle": "Stephen",
      "last": "Doe",
      "organization_id": "sdf34g3",
      "assigned_user": 562,
      "created_at": "2016-09-12 18:45:29",
      "updated_at": "2016-09-12 18:45:29"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "meta": {
      "type": "object",
      "properties": {
        "total": {
          "type": "number",
          "description": "Total number of records that match your parameters"
        },
        "current_page": {
          "type": "number",
          "description": "Current page of results being sent"
        },
        "total_pages": {
          "type": "number",
          "description": "Total number of pages in result set"
        }
      }
    },
    "customers": {
      "type": "array"
    }
  }
}

Create a New Customer
POST/customers

Create a new customer record for your team

Example URI

POST https://app.petrisuite.com/api/customers
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "email": "[email protected]",
  "first": "John",
  "middle": "James",
  "last": "Doe",
  "assignedUser": 1,
  "organizationId": "o2iu37908f72"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "Email Address for the customer"
    },
    "first": {
      "type": "string",
      "description": "First name"
    },
    "middle": {
      "type": "string",
      "description": "Middle name"
    },
    "last": {
      "type": "string",
      "description": "Last name"
    },
    "assignedUser": {
      "type": "number",
      "description": "Assigned User / Owner ID"
    },
    "organizationId": {
      "type": "string",
      "description": "Organization ID that customer is a member of"
    }
  },
  "required": [
    "email"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "Success message",
  "id": "sdf34g3"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string",
      "description": "A Success Message"
    },
    "id": {
      "type": "string",
      "description": "The ID of the customer that was updated"
    }
  }
}

Customer Fields

List Fields
GET/customers/fields

Fetches all fields available / required for creation of a new record

Example URI

GET https://app.petrisuite.com/api/customers/fields
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "email": {
    "name": "Email Address",
    "required": true,
    "type": "email"
  },
  "attr-source": {
    "name": "Source",
    "required": false,
    "type": "list",
    "options": [
      "Option",
      "Option",
      "Option"
    ]
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "email": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Friendly name of attribute"
        },
        "required": {
          "type": "boolean",
          "description": "If the attribute is required to create a record"
        },
        "type": {
          "type": "string",
          "description": "Type information of the field"
        }
      },
      "description": "Attribute Key"
    },
    "attr-source": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Friendly name of attribute"
        },
        "required": {
          "type": "boolean",
          "description": "If the attribute is required to create a record"
        },
        "type": {
          "type": "string",
          "description": "Type information of the field"
        },
        "options": {
          "type": "array",
          "description": "Array of custom options for list-type attributes"
        }
      },
      "description": "A custom attribute Key"
    }
  }
}

Single Customer

For customer creation, see the POST method of Customer Collections.

Update a Customer
POST/customers/{id}

Updates an existing customer record

Example URI

POST https://app.petrisuite.com/api/customers/xxxxxx
URI Parameters
HideShow
id
string (required) Example: xxxxxx

Customer ID to Update

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "email": "[email protected]",
  "first": "John",
  "middle": "James",
  "last": "Doe",
  "assignedUser": 1,
  "organizationId": "xxxxxx"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "Email Address for the customer"
    },
    "first": {
      "type": "string",
      "description": "First name"
    },
    "middle": {
      "type": "string",
      "description": "Middle name"
    },
    "last": {
      "type": "string",
      "description": "Last name"
    },
    "assignedUser": {
      "type": "number",
      "description": "Assigned User / Owner ID"
    },
    "organizationId": {
      "type": "string",
      "description": "Organization ID that customer is a member of"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "Success message",
  "id": "sdf34g3"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string",
      "description": "A Success Message"
    },
    "id": {
      "type": "string",
      "description": "The ID of the customer that was updated"
    }
  }
}

Fetch a Customer
GET/customers/{id}

Fetches all information about a customer

Example URI

GET https://app.petrisuite.com/api/customers/xxxxxx
URI Parameters
HideShow
id
string (required) Example: xxxxxx

Customer ID

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "xxxxxx",
  "email": "[email protected]",
  "first": "John",
  "middle": "Stephen",
  "last": "Doe",
  "organization_id": "sdf34g3",
  "assigned_user": 562,
  "created_at": "2016-09-12 18:45:29",
  "updated_at": "2016-09-12 18:45:29",
  "interactions": [
    {
      "customer_id": "xxxxxx",
      "description": "Filled out lead gen form",
      "source": "Website",
      "created_at": "2016-09-12 18:45:29"
    },
    {
      "customer_id": "xxxxxx",
      "description": "Filled out lead gen form",
      "source": "Website",
      "created_at": "2016-09-12 18:45:29"
    }
  ],
  "organization": {
    "id": "xxxxxx",
    "name": "Company Co Inc",
    "address": "123 Anystreet",
    "city": "Townsville",
    "state": "OH",
    "zip": "45342",
    "created_at": "2016-09-12 18:45:29",
    "updated_at": "2016-09-12 18:45:29"
  },
  "tags": [
    "Tag",
    "Tag",
    "Tag"
  ],
  "notes": []
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "email": {
      "type": "string"
    },
    "first": {
      "type": "string"
    },
    "middle": {
      "type": "string"
    },
    "last": {
      "type": "string"
    },
    "organization_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "The customer's organization ID"
    },
    "assigned_user": {
      "type": [
        "number",
        "null"
      ],
      "description": "ID of the assigned user / owner"
    },
    "created_at": {
      "type": "string"
    },
    "updated_at": {
      "type": "string"
    },
    "interactions": {
      "type": "array"
    },
    "organization": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "zip": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "tags": {
      "type": "array"
    },
    "notes": {}
  },
  "required": [
    "email"
  ]
}

Delete a Customer
DELETE/customers/{id}

Deletes a customer record

Example URI

DELETE https://app.petrisuite.com/api/customers/xxxxxx
URI Parameters
HideShow
id
string (required) Example: xxxxxx

Customer ID

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "Customer Deleted"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string",
      "description": "Success Message"
    }
  }
}

Single Customer Avatar

Used to update a customer’s avatar (photo).

Update Avatar
POST/customers/{id}/avatar

Updates the customer’s photo. Accepts Image File Types (jpg, png).

Example URI

POST https://app.petrisuite.com/api/customers/xxxxxx/avatar
URI Parameters
HideShow
id
string (required) Example: xxxxxx

Customer ID

Request
HideShow
Headers
Content-Type: multipart/form-data
Body
{
  "file": "USE <INPUT TYPE=FILE />"
}
Schema
{
  "type": "object",
  "properties": {
    "file": {
      "type": "string",
      "description": "A file Input"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "File Uploaded",
  "url": "Hello, world!"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string",
      "description": "A success message"
    },
    "url": {
      "type": "string",
      "description": "The url of the uploaded file."
    }
  }
}

Latest Customers

Recently Updated Customers
GET/customers/latest{?limit}

Returns a list of customers that have recently been updated

Example URI

GET https://app.petrisuite.com/api/customers/latest?limit=20
URI Parameters
HideShow
limit
number (optional) Example: 20

How many records to return

Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": "xxxxxx",
    "email": "[email protected]",
    "first": "John",
    "middle": "Stephen",
    "last": "Doe",
    "organization_id": "sdf34g3",
    "assigned_user": 562,
    "created_at": "2016-09-12 18:45:29",
    "updated_at": "2016-09-12 18:45:29"
  },
  {
    "id": "xxxxxx",
    "email": "[email protected]",
    "first": "John",
    "middle": "Stephen",
    "last": "Doe",
    "organization_id": "sdf34g3",
    "assigned_user": 562,
    "created_at": "2016-09-12 18:45:29",
    "updated_at": "2016-09-12 18:45:29"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Customer Activity

Recent Customer Activity
GET/customers/activity

Fetches recent customer activity for your team

Example URI

GET https://app.petrisuite.com/api/customers/activity
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": "xxxxxx",
    "email": "[email protected]",
    "name": "John Doe",
    "description": "Filled out a form",
    "source": "Website",
    "date": {
      "date": "2016-05-23 16:30:49.000000",
      "timezone": "UTC"
    },
    "avatar": "//meiosis.io/filepath.jpg"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Generated by aglio on 31 Oct 2018