Basic Integration Pattern

For partners that want to integrate with DailyStory, but don't have an API, we recommend using the following pattern for building a simple API that DailyStory can consume.

Authorization

We recommend supporting either basic authentication using an Authorization header or Bearer authorization.

Data Types

DailyStory can handle any data type and we recommend using standard formats when serializing objects to JSON.

The only nuanced data type is datetime fields. Our preferred datetime format is to include the offset to allow our system to know the time zone the data is relative to. For example: 2021-01-23T16:33:37-06:00.

Error Handling

We recommend sending standard HTTP errors along with a JSON message.

For example if a customer record was not found for: GET /api/v1/customer/244988 we would ideally receive an HTTP 4XX error with the following body:

{
	"error": "No customer found for id 244988"
}

End Points

We generally recommend supporting at least 2 RESTful endpoints:

  • GET Customer - retrieve a single customer record using the customer's unique identifier.
  • GET Customers - retrieve a set of records based on a last updated timestamp.

Data to Include

We recommend including as much data as possible, but always recommend including standard fields such as:

  • First name
  • Last name
  • Email address
  • Mobile phone
  • City
  • State
  • Country

Any unique data, such as categories, last purchase date, last order date, date shipped, etc. should also be included. DailyStory will allow customers to build segments based on this data.

For example, a segment of customers that has spent more than $N. Or, customers that haven't shopped in the past N days.

Get Customer

The Get Customer endpoint should allow for a single record to be retrieved based on your unique customer id. This endpoint is used for resyncing records or verifying that a synced record is correct.

For example: GET /api/v1/customer/{unique id} might return:

{
	"id": 244988,
	"first_name": "Amanda",
	"last_name": "Grover",
	"mobile_phone": "5553728048",
	"email": "[email protected]",
	"points": 322,
	"allow_sms": true,
	"allow_email": false,
	"city": "Seattle",
	"state": "Washington",
	"address": null,
	"zip": null,
	"birth_date": null,
	"store_id": 598,
	"total_orders": 65,
	"total_sales": 4118.01,
	"date_first_order": "2021-01-23T16:33:37-06:00",
	"date_last_order": "2021-10-06T13:01:27-05:00",
	"last_order_value": 30.68,
	"categories": [
		"Beauty ",
		"Health"
	]
}

Get Customers

The Get Customers endpoint should return a paged list of records filtered by the a last updated timestamp. This allows DailyStory to make a request for all records since a point in time, typically since the last sync was run.

For example: GET /api/v1/customers?last_updated=2022-07-03T12:33;45 might return:

{
	"count": 6692,
	"start": "0",
	"limit": "25",
	"records": [{
			// record #1 --- see above example for record definition
		},
		{
			// additional records 2 - 25 in set not shown
		}
	]
}