Skip to content

Analytics API: Shares

Gene Stevens edited this page Mar 10, 2012 · 1 revision

This API initiates a download of share activity. Filters can be used to narrow the search as well as to manage the download size.

URI for Shares

  • Format: analytics/shares
  • Verbs: GET

Output Columns

  • short_id: The short item ID which was shared
  • item_id: The item ID (product ID) which was shared (as provided by the customer)
  • item_category: The category of the product which was shared
  • timestamp: The time in UTC when the share happened
  • share_id: A unique ID for this share
  • user_id: An anonymized user ID who performed the share
  • recipient_count: How many distinct recipients were on the share
  • message_count: How many messages have been posted in the associated conversation so far
  • last_message_timestamp: The time in UTC when the most recent message was posted

Output Filters

  • short_id: (e.g., ab12) - Exact match only
  • item_id: (e.g., item-0001) - Exact match only
  • item_category: (e.g., Inventory) - Exact match only
  • timestamp: (e.g., 2012-02-16, 2012-02-16 07:01:54, 2012-02-16 07:01:54+05) A range search only (no exact match), actual parameters consist of one or both of the following. Values are date or date + time, and are accepted as UTC if a timezone is not provided.
  • timestamp_from: only values on or after this date/time
  • timestamp_to: only values on or before this date/time
  • share_id: (e.g., 1795549116_4f2f1f70e4f0e) - Exact match only
  • user_id: (e.g., 28d2d5adcedf14fc450689a5201effab) - Exact match only
  • recipient_count: (e.g., 3) An exact match or range search consisting of one or more of the following
  • recipient_count: only shares with exactly this number of unique recipients
  • recipient_count_from: only shares with this number or more unique recipients
  • recipient_count_to: only shares with this number or fewer unique recipients
  • message_count: (e.g., 12) An exact match or range search consisting of one or more of the following
  • message_count: only shares with exactly this number of messages
  • message_count_from: only shares with this number or more messages
  • message_count_to: only shares with this number or fewer messages
  • last_message_timestamp: (e.g., 2012-02-16, 2012-02-16 07:01:54, 2012-02-16 07:01:54+05) A range search only (no exact match), actual parameters consist of one or both of the following. Values are date or date + time, and are accepted as UTC if a timezone is not provided.
  • last_message_timestamp_from: only values whose most recent message is on or after this date/time
  • last_message_timestamp_to: only values whose most recent message is on or before this date/time

Filter Notes

  • timestamp_from and timestamp_to default to the start of the day when only the day is specified.
  • To inclusively search for a timestamp range between two days be sure to specify the the time. E.g., from 2012-02-16:00:00:00 to 2012-02-17:23:59:59

GET Requests

CSV Example

Example CSV curl request

curl -v -X GET \
	 -H 'X-ActiveTag-AccessToken: 99065137-f220-4282-b228-07d97935b41d' \
	 -H 'Accept: text/csv' \
	 'https://api.taglabsinc.com/analytics/shares'

Example CSV curl response

< HTTP/1.1 200 OK
< Date: Thu, 01 Mar 2012 21:09:38 GMT
< Server: Apache/2.2.20 (Ubuntu) mod_ssl/2.2.20 OpenSSL/1.0.0e
< Content-disposition: attachment;filename=shares.csv
< Content-Length: 4892
< Content-Type: text/csv;charset=utf-8
<
short_id,item_id,item_category,timestamp,share_id,user_id,recipient_count,message_count,last_message_timestamp
ab12,item-0001,Inventory,"2012-02-18 03:48:00",1796649116_4f3f1f70d4f0d,8acf5b0beee67d0b805bcb860a39721c,3,1,"2012-02-18 03:48:00"
ab12,item-0001,Inventory,"2012-02-17 21:14:58",1500784400_4f3ec352df892,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-17 21:14:58"
ab12,item-0001,Inventory,"2012-02-17 23:30:32",794795891_4f3ee318eee09,e9d35024dd4dc2d01291e053f6eec15c,3,4,"2012-02-17 23:48:59"
cd34,item-0002,Inventory,"2012-02-17 22:42:13",1906544385_4f3ed7c5486f0,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-17 22:42:13"
cd34,item-0002,Inventory,"2012-02-17 23:17:25",883616806_4f3ee005d0c04,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-17 23:17:25"
ab12,item-0001,Inventory,"2012-02-17 22:43:31",456179396_4f3ed813af95c,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-17 22:43:31"
ab12,item-0001,Inventory,"2012-02-17 22:51:09",1477813617_4f3ed9dda9e3e,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-17 22:51:09"

XML Example

Example XML curl request

curl -v -X GET \
	 -H 'X-ActiveTag-AccessToken: 99065137-f220-4282-b228-07d97935b41d' \
	 -H 'Accept: application/xml' \
	 'https://api.taglabsinc.com/analytics/shares'

Example XML curl response

< HTTP/1.1 200 OK
< Date: Thu, 01 Mar 2012 21:17:34 GMT
< Server: Apache/2.2.20 (Ubuntu) mod_ssl/2.2.20 OpenSSL/1.0.0e
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
< Content-Type: text/xml;charset=utf-8
<
<?xml version="1.0"?>
<shares>
<row><short_id>965p</short_id><item_id>recommend-app</item_id><item_category>Marketing</item_category><timestamp>2012-02-25 17:05:47</timestamp><share_id>187912347_4f4914eb706bc</share_id><user_id>e9d35024dd4dc2d01291e053f6eec15c</user_id><recipient_count>3</recipient_count><message_count>1</message_count><last_message_timestamp>2012-02-25 17:05:47</last_message_timestamp></row>
<row><short_id>a7q7</short_id><item_id>gene-0001</item_id><item_category>Gene</item_category><timestamp>2012-02-18 03:48:00</timestamp><share_id>1796649116_4f3f1f70d4f0d</share_id><user_id>8acf5b0beee67d0b805bcb860a39721c</user_id><recipient_count>3</recipient_count><message_count>1</message_count><last_message_timestamp>2012-02-18 03:48:00</last_message_timestamp></row>
<row><short_id>a7q7</short_id><item_id>gene-0001</item_id><item_category>Gene</item_category><timestamp>2012-02-17 21:14:58</timestamp><share_id>1500784400_4f3ec352df892</share_id><user_id>e9d35024dd4dc2d01291e053f6eec15c</user_id><recipient_count>3</recipient_count><message_count>1</message_count><last_message_timestamp>2012-02-17 21:14:58</last_message_timestamp></row>
<row><short_id>a7q7</short_id><item_id>gene-0001</item_id><item_category>Gene</item_category><timestamp>2012-02-17 23:30:32</timestamp><share_id>794795891_4f3ee318eee09</share_id><user_id>e9d35024dd4dc2d01291e053f6eec15c</user_id><recipient_count>3</recipient_count><message_count>4</message_count><last_message_timestamp>2012-02-17 23:48:59</last_message_timestamp></row>
</shares>

Filter Example

Example filter timestamp curl request

curl -v -X GET \
	 -H 'X-ActiveTag-AccessToken: 99065137-f220-4282-b228-07d97935b41d' \
	 -H 'Accept: text/csv' \
	 'https://api.taglabsinc.com/analytics/shares?timestamp_from=2012-02-16&timestamp_to=2012-02-18'

Example filter timestamp curl response

< HTTP/1.1 200 OK
< Date: Thu, 01 Mar 2012 21:37:59 GMT
< Server: Apache/2.2.20 (Ubuntu) mod_ssl/2.2.20 OpenSSL/1.0.0e
< Content-disposition: attachment;filename=shares.csv
< Content-Length: 1240
< Content-Type: text/csv;charset=utf-8
<
short_id,item_id,item_category,timestamp,share_id,user_id,recipient_count,message_count,last_message_timestamp
ab12,item-0001,Inventory,"2012-02-16 22:53:32",379381683_4f3eda6c9d116,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-16 22:53:32"
ab12,item-0001,Inventory,"2012-02-16 22:47:33",1043779441_4f3ed9059be12,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-16 22:47:33"
cd34,item-0002,Inventory,"2012-02-17 23:18:16",571161534_4f3ee03903232,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-17 23:18:16"
ab12,item-0001,Inventory,"2012-02-17 22:51:09",1477813617_4f3ed9dda9e3e,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-17 22:51:09"
ab12,item-0001,Inventory,"2012-02-17 22:43:31",456179396_4f3ed813af95c,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-17 22:43:31"
cd34,item-0002,Inventory,"2012-02-17 23:17:25",883616806_4f3ee005d0c04,e9d35024dd4dc2d01291e053f6eec15c,3,1,"2012-02-17 23:17:25"

Clone this wiki locally