Skip to content

Reports

Segments are pre-defined “views” of your data. You can create a segment from almost any data type, and the report will only show data that matches the segment’s filter rules. The Sheep system comes with a large number of automatic segments created for common use cases. You can also create your own segments.

Reports are asynchronous — you must request the report and then come back once it has been processed. The report file will be stored on Amazon S3 when it is ready.

ParameterDescription
templateOptional. Dictates which fields are visible in the report.
policyOptional. The security policy for the report. Only needed if you wish to export fields beyond the usual security policies.
gdpr_bypassOptional. Defaults to False. Set True to bypass GDPR checking.
gdpr_bypass_reasonRequired if GDPR bypass is set. You must provide a reason.
gdpr_channelOptional. For PDF reports: process (default), post, email.
GET https://sls-api.sheepcrm.com/segments/v2/example/segment/{uid}/all/{format}/
Authorization: Bearer $API_KEY
HTTP/1.0 200 OK
{
"bucket": "example",
"journal_uri": "/example/journal/634db79....d005c2a/",
"lambda_prefix": "sheepcrm-reports",
"policy": "membership",
"report_format": "xlsx",
"template": "/example/template/634d41.....63821e1a/",
"uid": "634d38a....21d46",
"use_mapreduce": true,
"user_uri": "/sheepcrm/user/554b31....00a4b4/"
}

The journal_uri in the response is the URI of a notification/reminder/task created for the user. The notification is created with a “preparing” title and will be updated with the report’s status and the S3 link when it is ready to download. If the report fails, the notification will be updated with the error message.

Use Excel reports to get access to the underlying data:

{segment_uri}/all/xlsx/

Use PDF reports to get printable versions of the data. PDF templates can be user generated content or a fixed format report:

{segment_uri}/all/pdf/
TemplateSizeDescription
sheep-card-standard8.51 x 5.51 cmSimple membership card
sheep-receipt-a5A5 LandscapePayment receipt
sheep-membership-certificate-a4A4 PortraitMembership certificate
sheep-invoice-a4A4 PortraitInvoice
TemplateSizeDescription
avery-34781 x 1Address labels
q-connect-kf260501 x 1Address labels
q-connect-kf260561 x 2Address labels
q-connect-kf022462 x 2Address labels
q-connect-kf714612 x 3Address labels
q-connect-kf260552 x 4Address labels
q-connect-kf260532 x 8Address labels
q-connect-kf260523 x 6Address labels
q-connect-kf260542 x 7Address labels
q-connect-kf260513 x 7Address labels
q-connect-kf260713 x 8Address labels
avery-36523 x 7Address labels
avery-36532 x 7Address labels
avery-3653-p2 x 7Address labels
avery-34842 x 8Address labels
avery-34274 x 2Address labels
avery-34758 x 3Address labels
avery-34255 x 2Address labels
avery-34832 x 2Address labels
avery-36635 x 13Address labels
ryman-p16-universal-99x34mm2 x 8Address labels

For the full list of labels see the API call below.

GET https://sls-api.sheepcrm.com/reports/v2/pdf/address_labels/
Authorization: Bearer $API_KEY
HTTP/1.0 200 OK
{
"avery-3425": {
"height": 5.7,
"name": "avery-3425 (5 x 2)",
"unit": "cm",
"width": 10.5
},
"avery-3427": {
"height": 7.4,
"name": "avery-3427 (4 x 2)",
"unit": "cm",
"width": 10.5
}
}
ParameterDescription
bucketOptional. Pass the bucket (flock identifier) for additional custom certificates.
GET https://sls-api.sheepcrm.com/reports/v2/pdf/membership_certificates/
Authorization: Bearer $API_KEY
HTTP/1.0 200 OK
{
"sheep-membership-certificate-a4": {
"height": 29.7,
"name": "sheepCRM A4 portrait",
"unit": "cm",
"width": 21.0
}
}
ParameterDescription
bucketRequired.
GET https://sls-api.sheepcrm.com/reports/v2/pdf/letters/
Authorization: Bearer $API_KEY
HTTP/1.0 200 OK
{
"/example/template/63490b08fa78f4fa203eedea/": {
"height": 29.7,
"name": "Thank you for your completed membership application",
"unit": "cm",
"width": 21.0
},
"/example/template/634d41ddcffe37f863821e1a/": {
"height": 29.7,
"name": "Subscription Renewal PDF",
"unit": "cm",
"width": 21.0
}
}

Create a one-off Mailchimp segment from the Sheep segment:

{segment_uri}/all/sync_mailchimp/
ParameterDescription
nameOptional. Name of the Mailchimp segment (will be prefixed by sheepCRM segment:). Defaults to the segment name if not provided.
ParameterDescription
segment_uriRequired. The segment URI.
templateRequired (unless subject and body are provided). Template to use for the message.
subjectRequired (unless template is provided). Subject of the email.
bodyRequired (unless template is provided). Body of the message.
gdpr_bypassOptional. Set to true to bypass the GDPR checks.
message_typeOptional. Default = “email”. Can be “sms”, “email”, “in-app” or “post” (bulk post not yet implemented).
POST https://api.sheepcrm.com/api/v1/example/reports/segment_email_builder/
Authorization: Bearer $API_KEY
Content-Type: application/json
{
"segment_uri": "/example/segment/632c65beb05d1aa53ac6b923/",
"subject": "test 1",
"body": "hi {{first_name}}"
}
HTTP/1.1 200 OK
{
"bad": 9,
"duplicate": 0,
"message": "/example/message/637e3cf3b443397649e785de/",
"missing": 0,
"num_contacts": 66,
"query": {
"membership_record_status": "active",
"exact": true,
"mode": "AND"
},
"segment_uri": "/example/segment/632c65beb05d1aa53ac6b923/",
"skipped": 0
}