Creating Segments

Last updated:

Prisma Campaigns offers the opportunity to create segments from API in order to facilitate the integration with external systems, which may want to decide which customers belong to which segment. This is usually the case when integrating datawarehouse or data intensive solutions.

Creating from a spreadsheet

This API creates a new segment based on a spreadsheet, uploaded on this same API call.

Column mapping is not allowed in this API call, so all defined columns in the uploaded spreadsheet, must already exist as customer model fields in Prisma, with exactly the same name.

URL Method Data
/api/segments/create-from-spreadsheet POST Multipart form data

The format of the posted data is multipart/form-data and this is the list of expected form fields to be posted on the API call.

Parameter Description
app-token The integrated application token to identify and authenticate this api call
segment-name The segment name to be created
file The csv file containing the data to be uploaded to this particular segment

Possible HTTP code return values are:

Status code Description Response
200 The operation was completed successfully Newly created segment id
400 Invalid parameters specified Name of the invalid parameter
500 Failure creating segment Error description

When the operation completes successfully an object is returned with an attributed named segment-id

{“segment-id”:17592235066109}

Response Format

The Accept header neeeds to be set specifying the desired response format, default is application/edn

Invocation Sample

The REST API can be called from any programming language supporting HTTP protocol.

Follows an invocation sample using curl

curl -v -H “Accept: application/json” -F app-token=d63f4542-87e5-4570-8540-ef828afdfb40 -F segment-name=NewSegment -F file=@/Path/spreadsheet.csv https://domain/api/segments/create-from-spreadsheet