Enterprise APIs

API Access to import and export data

There are several public and private methods to import and export data into pyze. Contact your account manager for full access to the entire suite of available Bulk and Streaming data API’s

User Profiles

The User Profiles API allows to add data about your users that may come from your backend or any other external systems.

You can obtain your User Profiles upload API endpoint and credentials from your Pyze Account manager. This documentation will use https://import.pyze.com/users/profile as an example.

User Profile Attributes Object Specification

You can use this api to create or update any Pyze or custom attribute in the given user profile. Each request may include up to 50 profile fields.

FieldName Key Type Description Required
userId string Customer id for this user in your database, identifies a user uniquely Y
Pyze User Profile Fields Varies Available fields N
my_custom_attribute Varies Available Types N

To remove a profile attribute, set it to null.

Custom Attributes

The following data types can be stored as a custom attribute:

Data Type Example Values
Boolean { "subscribed": true }
Strings {subscription_type: "Silver" }
Integer { "score": 30 }
Dates { "subscription_start": "2017-07-13T17:44:46Z" } Dates must be in ISO 8601 Format
Arrays { "categories": [ "electronics", "computers" ] }

Example call

POST https://import.pyze.com/users/profile
Content-Type: application/json
{
  "user_profiles":
      [
      	"customer_id": "user123",
	    "user_alias": {
	        "alias_label": "facebook",
	        "alias_id": "fb123409"
	    },
	    "first_name": "John",
	    "last_name": "Doe",
	    "date_of_first_use": "2016-04-12T17:27:20+00:00",
	    "date_of_birth": "1994-07-06",
	    "gender": "F",
	    "custom-ltv": 35,
	    "custom-purchase": {
	        "inc": 30
	    },
	    "custom-subscription": "premium",
	    "custom-tags": ["whale", "high-spender"]
    ],
    [
	    "pyze_id": "ca1ab028-185d-4833-a3af-5b5d46b62771",
	    "date_of_last_use": "2018-06-20T08:17:00+00:00",
	    "email_id": "jane.doe@gmail.com",
	    "custom-tags": {"remove" :['whale']}
    ]
}

Posting Events From Server to Pyze

Enterprise customers can also post event data to Pyze from their backend using a RESTful API.

The Pyze Enterprise Events API allows you to send events from your servers along with the data from your mobile and web apps. You can send these events at the same speed as the Pyze SDK’s and with the same level of detail.

The Pyze Enterprise Events API accepts HTTPS POST events. You can attach any custom attribute data to an event, and use this data throughout the Pyze system as attributes to filter and understand your users.

Endpoint

The url for all transactions is: https://import.pyze.com/v1/events

Content-Type HTTP Header should be application/json

Data Format

The Pyze Enterprise Events API accepts standard JSON documents with the following fields

FieldName Key Type Description Required
type string Type of the request message, events required
event string Name of the custom event required
userId strin Unique Identifier for the user required
eventTime string Timestamp when the event happened. ISO-8601 date string. required
context object optional
context.userAgent string User agent of users device optional
context.ip string Users current ip address optional
appKey string Pyze app key required
messageId string Unique identifier for each message optional
sentAt string Timestamp when the event is sent to Pyze, helps to correct clock skew. ISO-8601 date string optional
attributes object Key-Value pair. Additional properties about the event optional

Response

The Pyze Enterprise Events API will return a 202 response code if your event was properly formatted and accepted. The api will only validate if the overall format and validity of the JSON object, and if the request was properly Authenticated

| 202 | Event has been accepted for processing | | 400 | Not a valid input / “FieldName” is not provided | | 401 | Not authorized to view | | 403 | Need access to the provided app | | 500 | Pyze internal server error. Please contact Pyze if problem persist |

Example

A Curl Example:

curl -X POST -H "Content-Type: application/json" -d '{
    "type": "event",
    "event": "test-event",
    "userId": "Username",
    "eventTime": "2020-06-03T17:03:48-07:00",
    "attributes": {
      "key": "value"
    },
    "appKey": "yz1Jn-0pSnekg58etEQO4A"
}' "https://import.pyze.com/v1/events"

Last modified 2022-03-15