Sample Requests and Responses

This section provides some sample requests and responses for the List Lookup API. Once you have an authentication token, you can test the API and see responses using your own queries at https://api.smashfly.com/ListAPI/help; click Show Sample to see the requests and responses.

Sample Request

To retrieve the 1,000 lists, skipping the first 200:

/v1/lists https://api.smashfly.com/contactapi/v1/lists/?contactDbId=1&offset=200&limit=1000

Sample Response

The response includes the following fields.

Property Description
code Status code of the HTTP response. The API will return a 200 (OK) code if the request succeeds. If the request fails, it returns an error code.
message Brief message describing the result ("OK" if successful; an error message if the request failed.
limit Pagination limit used for the request.
offset Pagination offset used for the request.
total Total count of records that matched the parameters provided in the request.
returned Count of records returned in the response.
results

List information for any lists that matched the query parameters, including the following:

  • ID number of the list
  • Name of the list
  • Type of list (Contact, Event, or Job)
  • Status of the list (Active)
  • Number of contacts in the list

 

Following is a part of a sample response:

{

"code": 200,

"message": "OK",

"meta": {

"limit": 1000,

"offset": 0,

"total": 4210,

"returned": 1000

},

"result": [

{

"id": "102099",

"name": "Contact List 1",

"type": "Contact",

"status": "Active",

"contacts": 8

},

{

"id": "E827032",

"name": "Event 1",

"type": "Event",

"status": "Active",

"contacts": 22

},

{

"id": "JID_799340_7022",

"name": "Senior Engineer",

"type": "Job",

"status": "Active",

"contacts": 34

}]

}

 

Sample Errors

For requests that result in an error, the corresponding response will specify a relevant HTTP status code, as well as pertinent error messaging describing the failure. Following are some examples of error responses.

Invalid Token Provided

{

"code": 401,

"message": "Unauthorized",

"errors": [

{

"message": "Access denied"

}

]

}

Request Validation Error

{

"code": 400,

"message": "Errors occurred validating the request",

"errors": [

{

"message": "Expecting a valid date in the form yyyy-mm-dd",

"field": "ToAddedOn"

},

{

"message": "Value is invalid, expecting delimited list of integers",

"field": "ContactListIds"

}

]

}

Maximum Result Count Exceeded

{

"code": 403,

"message": "Request refused",

"meta": {

"limit": 1000,

"offset": 0,

"total": 107834,

"returned": 0

}

"errors": [

{

"message": "Maximum result count exceeded",

"description": "The requested query returns greater than 10,000 results."

}

]

}

BETA VERSION