Events
Version: 1.0
Events are generated by specific haravan resources when specific things happen, such as the creation of an article, the placement or fulfillment of an order, the addition or deletion of a product, and so on. By requesting events, your app can get a "log" of important occurrences in the operation of a shop.
Caution
The events returned by the Events API should not be considered to be realtime. Events might not appear in the list returned by the API until a few seconds after they've occurred. In rare cases (<1% of the time) it can take up to a few minutes for some events to appear.
Events are generated by these haravan resources:
Article events
VERB | MESSAGE | DESCRIPTION |
---|---|---|
create | New article created: article_url | The article was created. |
destroy | article_url was destroyed. | The article was deleted. |
published | article_url was published. | The article was published. |
unpublished | article_url was unpublished. | Article was unpublished. |
update | article_url was updated (but its published state was not changed). | Article was updated. |
Blog events
VERB | MESSAGE | DESCRIPTION |
---|---|---|
create | New blog created: new_blog_url | The blog was created. |
destroy | blog_name was destroyed. | The blog was deleted. |
update | blog_name was updated. | Blog was updated. |
Collection events
VERB | MESSAGE | DESCRIPTION |
---|---|---|
create | New collection created: collection_url | The collection was created. |
destroy | collection_url was destroyed. | The collection was deleted. |
published | collection_url was published. | The collection was published. |
unpublished | collection_url was hidden. | Collection was hidden. |
update | collection_url was updated. | Collection was updated. |
Comment events
VERB | MESSAGE | DESCRIPTION |
---|---|---|
create | New comment for article_url : comment_excerpt | The comment was created. |
Order events
There are a lot of events associated with orders. A few are generated by the order itself, but many more are generated by all the things that can happen in the time between the placing of an order and its closing or cancellation. Order events can be divided into the following categories:
- Authorization: success, failure and pending
- Capture: success, failure and pending
- Email: for confirmation of the order, shipping and cancellation
- Fulfillment: success, failure, pending, cancellation, restocking and update
- Order: placing, confirmation, closing, reopening and cancellation
- Refund: success, failure and pending
- Sale: success, failure and pending
- Void: success, failure and pending
VERB | MESSAGE | DESCRIPTION |
---|---|---|
authorization_failure | The customer, unsuccessfuly, tried to authorize: | Authorization failed. The funds cannot be captured. |
authorization_pending | Authorization for is pending. | Authorization failed. The funds cannot be captured. |
authorization_success | The customer successfuly authorized us to capture: | Authorization was successful and the funds are available for capture. |
cancelled | Order was cancelled by . | The order was cancelled. |
capture_failure | We failed to capture: | Capture failed. The funds cannot be transferred to the shop. |
capture_pending | Capture for is pending. | Capture is in process. The funds are not yet available to the shop. |
capture_success | We succesfully captured: | Capture was succesfull and the funds are now available to the shop. |
closed | Order was closed. | The order was closed. |
confirmed | Recieved a new order: by . | The order was confirmed. |
fulfillment_cancelled | We cancelled from being fulfilled by the third party fulfillment service. | Fulfillment for one or more of the line_items failed. |
fulfillment_pending | We submitted to the third party service. | One or more of the line_items has been assigned to a third party service for fulfillment. |
fulfillment_success | We successfuly fulfilled line_items. | Fulfillment was succesfull for one or more line_items. |
mail_sent | email was sent to the customer. | An email was sent to the customer. |
placed | Order was placed. | An order was placed by the customer. |
re_opened | Order was re-opened. | The order was re-opened. |
refund_failure | We failed to refund . | Refund failed. The funds are still with the shop. |
refund_pending | Refund of is still pending. | Refund is in process. The funds are still with shop. |
refund_success | We successfuly refunded . | Refund was successful. The funds have been transferred to the customer. |
restock_line_items | We restocked . | One or more of the order's line items have been restocked. |
sale_failure | The customer failed to pay . | Sale failed. The funds are not available to the shop. |
sale_pending | The is pending. | Sale is in process. The funds are not yet available to the shop. |
sale_success | We successfully captured . | We successfuly captured money_amount. Sale was successful. The funds are now with the shop. |
update | was updated. | The order was updated. |
void_failure | We failed to void the authorization. | Voiding the authorization failed. The authorization is still valid. |
void_pending | Authorization void is pending. | Voiding the authorization is in process. The authorization is still valid. |
void_success | We successfully voided the authorization. | Voiding the authorization was successful. The authorization is no longer valid. |
Page events
VERB | MESSAGE | DESCRIPTION |
---|---|---|
create | New page created: page_url | The page was created. |
destroy | page_url was destroyed. | The page was deleted. |
published | page_url was published. | The page was published. |
unpublished | page_url was hidden. | Page was hidden. |
update | page_url was updated. | Page was updated. |
Product events
VERB | MESSAGE | DESCRIPTION |
---|---|---|
create | New product created: product_title | The product was created. |
destroy | product_name was destroyed. | The product was deleted. |
published | product_title was published. | The product was published. |
unpublished | product_title was hidden. | Product was hidden. |
update | product_title was updated. | Product was updated. |
What can you do with Event?
The haravan API lets you do the following with the Event resource. More detailed versions of these general actions may be available:
- GET
https://apis.haravan.com/com/events.json
- GET
https://apis.haravan.com/com/events/{event_id}.json
- GET
https://apis.haravan.com/com/events/count.json
Event Properties
arguments
: string
"arguments": "IPod Nano - 8GB"
Refers to a certain event and its resources.
body
: string
"body": null
A text field containing information about the event.
created_at
: string
"created_at": "2008-01-10T11:00:00-05:00"
The date and time when the event was created. The API returns this value in ISO 8601 format.
id
: string
"id": "164748010"
The unique numeric identifier for the event.
description
: string
"description": "Received a new order"
A plain text description of the event.
path
: string
"path": "/admin/orders/1234"
A relative URL to the resource the event is for (may be null).
message
: string
"message": "Received new order"
Human readable text that describes the event.
subject_id
: string
"subject_id": "450789469"
The id of the resource that generated the event.
subject_type
: string
"subject_type": "Order"
The type of the resource that generated the event.
This will be one of the following: Article | Blog | Collection | Comment | Order | Page | Product
verb
: string
"verb": "confirmed"
The type of event that took place. Different resources generate different types of event; see Resources and their event verbs and messages (below) for details.
Receive a list of all Events.
limit
Amount of results
page
Page to show
since_id
Restrict results to after the specified ID
created_at_min
Show events created at or after date and time (format: 2008-12-31 03:00)
created_at_max
Show events created at or before date and time (format: 2008-12-31 03:00)
filter
Only show events specified in filter
verb
Only show events of a certain kind
fields
comma-separated list of fields to include in the response
The events you get back with this method are the same ones that show up in the shop's admin dashboard. Only events from the shop itself are returned; this does not include announcements from the haravan blog.
- GET
https://apis.haravan.com/com/events.json
Response:
Details
HTTP/1.1 200 OK
{
"events": [
{
"arguments": [
"IPod Touch 8GB"
],
"body": null,
"created_at": "2007-12-31T19:00:00-05:00",
"id": 677313116,
"subject_id": 921728736,
"subject_type": "Product",
"verb": "create",
"message": "created a new product: <a href="\/admin\/products\/921728736">IPod Touch 8GB<\/a>.",
"author": "haravan",
"description": null,
"path": "\/admin\/products\/921728736"
},
{
"arguments": [
"IPod Nano - 8GB"
],
"body": null,
"created_at": "2007-12-31T19:00:00-05:00",
"id": 365755215,
"subject_id": 632910392,
"subject_type": "Product",
"verb": "create",
"message": "created a new product: <a href="\/admin\/products\/632910392">IPod Nano - 8GB<\/a>.",
"author": "haravan",
"description": null,
"path": "\/admin\/products\/632910392"
},
{
"arguments": [
"#1001",
"Bob Norman"
],
"body": null,
"created_at": "2008-01-10T11:00:00-05:00",
"id": 164748010,
"subject_id": 450789469,
"subject_type": "Order",
"verb": "confirmed",
"message": "Received new order <a href="\/admin\/orders\/450789469">#1001<\/a> by Bob Norman",
"author": "haravan",
"description": "Received new order #1001 by Bob Norman",
"path": "\/admin\/orders\/450789469\/transactions\/#1001"
}
]
}
The created_at_min and created_at_max parameters are interpreted using the shop's timezone.
- GET
https://apis.haravan.com/com/events.json?created_at_min=2007-12-31 21:00:00
Response:
Details
HTTP/1.1 200 OK
{
"events": [
{
"arguments": [
"#1001",
"Bob Norman"
],
"body": null,
"created_at": "2008-01-10T11:00:00-05:00",
"id": 164748010,
"subject_id": 450789469,
"subject_type": "Order",
"verb": "confirmed",
"message": "Received new order <a href="\/admin\/orders\/450789469">#1001<\/a> by Bob Norman",
"author": "haravan",
"description": "Received new order #1001 by Bob Norman",
"path": "\/admin\/orders\/450789469\/transactions\/#1001"
}
]
}
Get all the events from a particular order
- GET
https://apis.haravan.com/com/orders/{order_id}/events.json
Response:
Details
HTTP/1.1 200 OK
{
"events": [
{
"arguments": [
],
"body": null,
"created_at": "2008-01-10T11:00:00-05:00",
"id": 852065041,
"subject_id": 450789469,
"subject_type": "Order",
"verb": "placed",
"message": "Order was placed",
"author": "haravan",
"description": "Order was placed",
"path": "\/admin\/orders\/450789469\/transactions\/"
},
{
"arguments": [
"#1001",
"Bob Norman"
],
"body": null,
"created_at": "2008-01-10T11:00:00-05:00",
"id": 164748010,
"subject_id": 450789469,
"subject_type": "Order",
"verb": "confirmed",
"message": "Received new order <a href="\/admin\/orders\/450789469">#1001<\/a> by Bob Norman",
"author": "haravan",
"description": "Received new order #1001 by Bob Norman",
"path": "\/admin\/orders\/450789469\/transactions\/#1001"
},
{
"arguments": [
"389404469",
"210.94",
"USD"
],
"body": null,
"created_at": "2008-01-10T11:00:00-05:00",
"id": 103105390,
"subject_id": 450789469,
"subject_type": "Order",
"verb": "authorization_success",
"message": "The customer successfully authorized $409.94 USD on Visa •••• •••• •••• 4242",
"author": "haravan",
"description": "The customer successfully authorized $409.94 USD on Visa •••• •••• •••• 4242",
"path": "\/admin\/orders\/450789469\/transactions\/389404469"
}
]
}
Get a 'page' of events from a particular order
- GET
https://apis.haravan.com/com/orders/{order_id}/events.json?limit=1&page=2
Details
HTTP/1.1 200 OK
{
"events": [
{
"arguments": [
"#1001",
"Bob Norman"
],
"body": null,
"created_at": "2008-01-10T11:00:00-05:00",
"id": 164748010,
"subject_id": 450789469,
"subject_type": "Order",
"verb": "confirmed",
"message": "Received new order <a href="\/admin\/orders\/450789469">#1001<\/a> by Bob Norman",
"author": "haravan",
"description": "Received new order #1001 by Bob Norman",
"path": "\/admin\/orders\/450789469\/transactions\/#1001"
}
]
}
Get all the events from a particular product
- GET
https://apis.haravan.com/com/products/{product_id}/events.json
Response:
Details
HTTP/1.1 200 OK
{
"events": [
{
"arguments": [
"IPod Touch 8GB"
],
"body": null,
"created_at": "2007-12-31T19:00:00-05:00",
"id": 677313116,
"subject_id": 921728736,
"subject_type": "Product",
"verb": "create",
"message": "created a new product: <a href="\/admin\/products\/921728736">IPod Touch 8GB<\/a>.",
"author": "haravan",
"description": null,
"path": "\/admin\/products\/921728736"
}
]
}
Get all the events after the specified ID
- GET
https://apis.haravan.com/com/events.json?since_id=164748010
Response:
Details
HTTP/1.1 200 OK
{
"events": [
{
"arguments": [
"IPod Nano - 8GB"
],
"body": null,
"created_at": "2007-12-31T19:00:00-05:00",
"id": 365755215,
"subject_id": 632910392,
"subject_type": "Product",
"verb": "create",
"message": "created a new product: <a href="\/admin\/products\/632910392">IPod Nano - 8GB<\/a>.",
"author": "haravan",
"description": null,
"path": "\/admin\/products\/632910392"
},
{
"arguments": [
"IPod Touch 8GB"
],
"body": null,
"created_at": "2007-12-31T19:00:00-05:00",
"id": 677313116,
"subject_id": 921728736,
"subject_type": "Product",
"verb": "create",
"message": "created a new product: <a href="\/admin\/products\/921728736">IPod Touch 8GB<\/a>.",
"author": "haravan",
"description": null,
"path": "\/admin\/products\/921728736"
}
]
}
Only get events related to Products or Orders
- GET
https://apis.haravan.com/com/events.json?filter=Product,Order
Response:
Details
HTTP/1.1 200 OK
{
"events": [
{
"arguments": [
"IPod Touch 8GB"
],
"body": null,
"created_at": "2007-12-31T19:00:00-05:00",
"id": 677313116,
"subject_id": 921728736,
"subject_type": "Product",
"verb": "create",
"message": "created a new product: <a href="\/admin\/products\/921728736">IPod Touch 8GB<\/a>.",
"author": "haravan",
"description": null,
"path": "\/admin\/products\/921728736"
},
{
"arguments": [
"IPod Nano - 8GB"
],
"body": null,
"created_at": "2007-12-31T19:00:00-05:00",
"id": 365755215,
"subject_id": 632910392,
"subject_type": "Product",
"verb": "create",
"message": "created a new product: <a href="\/admin\/products\/632910392">IPod Nano - 8GB<\/a>.",
"author": "haravan",
"description": null,
"path": "\/admin\/products\/632910392"
},
{
"arguments": [
"#1001",
"Bob Norman"
],
"body": null,
"created_at": "2008-01-10T11:00:00-05:00",
"id": 164748010,
"subject_id": 450789469,
"subject_type": "Order",
"verb": "confirmed",
"message": "Received new order <a href="\/admin\/orders\/450789469">#1001<\/a> by Bob Norman",
"author": "haravan",
"description": "Received new order #1001 by Bob Norman",
"path": "\/admin\/orders\/450789469\/transactions\/#1001"
}
]
}
Only get events related to Products that were deleted
- GET
https://apis.haravan.com/com/events.json?filter=Product&verb=destroy
Response:
Details
HTTP/1.1 200 OK
{
"events": [
]
}
Receive a single Event.
fields
comma-separated list of fields to include in the response
Shows the same fields as the list action.
- GET
https://apis.haravan.com/com/events/677313116.json
Response:
Details
HTTP/1.1 200 OK
{
"event": {
"arguments": [
"IPod Touch 8GB"
],
"body": null,
"created_at": "2007-12-31T19:00:00-05:00",
"id": 677313116,
"subject_id": 921728736,
"subject_type": "Product",
"verb": "create",
"message": "created a new product: <a href="\/admin\/products\/921728736">IPod Touch 8GB<\/a>.",
"author": "haravan",
"description": null,
"path": "\/admin\/products\/921728736"
}
}
Receive a count of all Events.
created_at_min
Count events created at or after date and time (format: 2008-12-31 03:00)
created_at_max
Count events created at or before date and time (format: 2008-12-31 03:00)
Count all the events
- GET
https://apis.haravan.com/com/events/count.json
Response:
Details
HTTP/1.1 200 OK
{
"count": 3
}
Count the number of events since a particular time
- GET
https://apis.haravan.com/com/events/count.json?created_at_min=2007-12-31 21:00:00
Response:
Details
HTTP/1.1 200 OK
{
"count": 1
}