V3 REFERENCE Campaigns

/contactfilter

A list of filter expressions for use in newsletters.

List contactfilter resources available for this apikey, use a GET request. Alternatively, you may want to add one or more filters.

# list contactfilter resources

curl -s -X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactfilter
Unique Key

In addition to the resource $ID, you can also use the unique key $Name to identify this resource. Please refer to the field(s) description below for more information.

Properties
Name Description
Description Textual escription of the filter.
  • [ Type AnsiString ]
Expression Filter Expression. Checked for syntactical correctness when writing
  • [ Type AnsiString ]
ID ID of the filter
  • Read Only
  • [ Type Int64 ]
Name A unique name for this filter.
  • Unique
  • [ Type AnsiString ]
Status The status of the filter - used, unused, etc
  • [ Type TContactFilterStatus ]

Allowed values:
  • unused
  • used
  • deleted
Filters
Name Description
ShowDeleted Show or hide deleted items along with the other items
  • [ Type TBooleanFilter ]
Status Retrieve only contact filters with the specified status
  • [ Type AnsiString ]

Access a given contactfilter resource, use a GET request, providing the contactfilter's ID value.

# access the contactfilter resource identified by $ID

curl -s -X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactfilter/$ID

    
# access the resource through the Name's value
# note: all keys marked as 'unique' may be used as an alternate ID

curl -s -X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactfilter/$Name
    
    
Unique Key

In addition to the resource $ID, you can also use the unique key $Name to identify this resource. Please refer to the field(s) description below for more information.

Properties
Name Description
Description Textual escription of the filter.
  • [ Type AnsiString ]
Expression Filter Expression. Checked for syntactical correctness when writing
  • [ Type AnsiString ]
ID ID of the filter
  • Read Only
  • [ Type Int64 ]
Name A unique name for this filter.
  • Unique
  • [ Type AnsiString ]
Status The status of the filter - used, unused, etc
  • [ Type TContactFilterStatus ]

Allowed values:
  • unused
  • used
  • deleted

Add a new contactfilter resource with a POST request.

# add a new contactfilter resource, beware of the Read Only fields!

curl -s -X POST \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactfilter \
-H 'Content-Type: application/json' \
-d '{"Description": ...}'
Unique Key

In addition to the resource $ID, you can also use the unique key $Name to identify this resource. Please refer to the field(s) description below for more information.

Properties
Name Description
Description Textual escription of the filter.
  • [ Type AnsiString ]
Expression Filter Expression. Checked for syntactical correctness when writing
  • [ Type AnsiString ]
ID ID of the filter
  • Read Only
  • [ Type Int64 ]
Name A unique name for this filter.
  • Unique
  • [ Type AnsiString ]
Status The status of the filter - used, unused, etc
  • [ Type TContactFilterStatus ]

Allowed values:
  • unused
  • used
  • deleted

Update one specific contactfilter resource with a PUT request, providing the contactfilter's ID value. Be sure to include all the mandatory properties.

# update content of resource contactfilter identified by ID $ID

curl -s -X PUT \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactfilter/$ID \
-H 'Content-Type: application/json' \
-d '{"Description": ...}'

    
# update the content, using the value of the Name property
# note: all keys marked as 'unique' may be used as an alternate ID

curl -s -X PUT \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactfilter/:Name \
-H 'Content-Type: application/json' \
-d '{"Description": ...}'
    
Unique Key

In addition to the resource $ID, you can also use the unique key $Name to identify this resource. Please refer to the field(s) description below for more information.

Properties
Name Description
Description Textual escription of the filter.
  • [ Type AnsiString ]
Expression Filter Expression. Checked for syntactical correctness when writing
  • [ Type AnsiString ]
ID ID of the filter
  • Read Only
  • [ Type Int64 ]
Name A unique name for this filter.
  • Unique
  • [ Type AnsiString ]
Status The status of the filter - used, unused, etc
  • [ Type TContactFilterStatus ]

Allowed values:
  • unused
  • used
  • deleted

Remove one given contactfilter resource with a DELETE request, providing the contactfilter's ID value.

# delete resource contactfilter with ID $ID

curl -s -X DELETE \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactfilter/$ID
    
# delete the resource using the alternate unique key Name
# note: all keys marked as 'unique' may be used as an alternate ID

curl -s -X DELETE \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactfilter/:Name
    
Unique Key

In addition to the resource $ID, you can also use the unique key $Name to identify this resource. Please refer to the field(s) description below for more information.