Documentation Sweet Pricing API

POST / apps / :appId / segments

This endpoint creates a new user segment within an app, defined by a series of filters. This segment can be used in segmented pricing models.

URL

https://api.sweetpricing.com/v1.0/apps/:appId/segments

Header

Field Type Description
Authorization String

Header of form api-key <API key>

Authorization: api-key <API Key>

200

Field Type Description
name String

User-defined segment name

segmentfilters Object[]

Array of the filters that are applicable.

segmentfilters.isNegated Boolean

True if the filter is negated.

segmentfilters.filterfieldFiltertype Object
segmentfilters.filterfieldFiltertype.id String

ID of the filterfield-filtertype combination that is to be applied.

segmentfilters.params Object[]

Array of the parameters values to the filter. These are objects.

segmentfilters.params.value Mixed

Value of the parameter

Parameters

Field Type Description
:appId Number

App ID.

{
	"name": "Engagement > 80",
	"segmentfilters": [{
		"isNegated": false,
		"filterfieldFiltertype": {
			"id": 2
		},
		"params": [{
			"value": 80
		}]
	}]
}

200

Field Type Description
id Number

Segment ID

appId Number

App ID

name String

User-defined segment name

segmentfilters Object[]

Array of the filters that are applicable.

segmentfilters.isNegated Boolean

True if the filter is negated.

segmentfilters.filterfieldFiltertype Object
segmentfilters.filterfieldFiltertype.id String

Id of the filterfield-filtertype combination applied.

segmentfilters.filterfieldFiltertype.filtertype Object
segmentfilters.filterfieldFiltertype.filtertype.isStringExact Boolean

Is this string exactly matches filter?

segmentfilters.filterfieldFiltertype.filtertype.isStringContains Boolean

Is this string contains filter?

segmentfilters.filterfieldFiltertype.filtertype.isStringStartsWith Boolean

Is this string starts with filter?

segmentfilters.filterfieldFiltertype.filtertype.isStringEndsWith Boolean

Is this string ends with filter?

segmentfilters.filterfieldFiltertype.filtertype.isStringSet Boolean

Is this string contained in set filter?

segmentfilters.filterfieldFiltertype.filtertype.isIntEqual Boolean

Is this integer exactly equals filter?

segmentfilters.filterfieldFiltertype.filtertype.isIntGt Boolean

Is this integer greater than filter?

segmentfilters.filterfieldFiltertype.filtertype.isIntLt Boolean

Is this integer less than filter?

segmentfilters.filterfieldFiltertype.filterfield Object
segmentfilters.filterfieldFiltertype.filterfield.fieldName String

Name of the field that is used in the filter.

segmentfilters.params Object[]

Array of the parameters values to the filter. These are objects.

segmentfilters.params.value Mixed

Value of the parameter.

{
	"id": 2,
	"name": "Engagement > 80",
	"segmentfilters": [{
		"isNegated": false,
		"filterfieldFiltertype": {
			"id": 2,
			"filtertype": {
				"isStringExact": false,
				"isStringContains": false,
				"isStringStartsWith": false,
				"isStringEndsWith": false,
				"isStringSet": false,
				"isIntEqual": false,
				"isIntGt": true,
				"isIntLt": false
			},
			"filterfield": {
				"fieldName": "engagement14"
			}
		},
		"params": [{
			"value": 80
		}]
	}]
}

401

Name Description
401

You are not authenticated to perform the request.

403

Name Description
403

You are not allowed to view/modify this resource.

404

Name Description
404

Resource not found.