Analytics API

Summary

This API is used to download Foxtrot data programatically so you can feed it into your different tools. For help and definitions of each of the columns offered please refer to the File Download Page using your Foxtrot account.

Accessing Foxtrot data requires two steps, one is to create a request to download. This is where you define what dates, Distribution Centers and Analysis types you want.

There are two types of downloadable data:
  • ROUTE_ANALYTICS: These files contain per route analysis results
  • ATTEMPT_ANALYTICS: These files contain per attempt analysis results

Once a request is created, you can get a list of the files generated using the transaction ID returned on the request creation.

Resource Operation Description
Analytics GET /dcs/(dc_id)/routes/(route_id)/analytics/attempts Get Attempt Analytics for a single route
  GET /dcs/(dc_id)/routes/(route_id)/analytics/route Get Route Analytics for a single route
File Downloads GET /analytics/column-definitions Get Analysis Column Definitions
  POST /analytics/download-requests Post Analytics Download Request
  GET /analytics/download-requests/(download_request_txid)/files Get Route Analytics and/or Attempt Analytics

Details

GET /analytics/column-definitions
Status Codes:

Example response

{
  "status": "success",
  "data": {
    "route_analysis_column_definitions": {
      "dc_id": {
        "column_name": "DC ID",
        "column_description": "Distribution Center ID"
      },
      "dc_time_zone": {
        "column_name": "DC Time Zone",
        "column_description": "Local DC time zone"
      }, ...
    },
    "attempt_analysis_column_definitions": {
      "dc_id": {
        "column_name": "DC ID",
        "column_description": "Distribution Center ID"
      },
      "waypoint_id": {
        "column_name": "Waypoint ID",
        "column_description": "The unique identifier for this customer in this route. This is usually used by systems to identify a certain instance of a customer in a route."
      }, ...
    }
  }
}
POST /analytics/download-requests
Parameters:
  • dc_ids (list) – List of distribution center IDs, i.e. [“dc_id_1”, “dc_id_2”]
  • from_date (string) – The start date of date range you want to download files for, in YYYY-MM-DD format, local DC time for each DC
  • to_date (string) – The end date of date range you want to download files for, in YYYY-MM-DD format, local DC time for each DC
  • analytics_types (list) – List containing ROUTE_ANALYTICS and/or ATTEMPT_ANALYTICS, i.e. [“ROUTE_ANALYTICS”, “ATTEMPT_ANALYTICS”]
Status Codes:
  • 200 OK – An object containing your download request transaction id.
  • 400 Bad Request – Check error code within the response.
  • 401 Unauthorized – API key is invalid.
  • 403 Forbidden – One of the DC IDs specified does not belong to the account API Key.

Example response

{
  "status": "success",
    "data": {
      "download_request_txid": "abcdef123456"
    }
}
GET /dcs/(dc_id)/routes/(route_id)/analytics/attempts
Status Codes:
  • 200 OK – An object with the attempt analysis results.
  • 401 Unauthorized – API key is invalid.
  • 403 Forbidden – The DC ID specified does not belong to the account API Key.
  • 404 Not Found – The Route ID is invalid or the Attempt Analytics are not yet available

Example response

{
  "status": "success",
  "data": {
    "attempt_analytics": {[
      "dc_id": "2123",
      "dc_name": "My DC",
      ...
    ], ...}
  }
}
GET /dcs/(dc_id)/routes/(route_id)/analytics/route
Status Codes:
  • 200 OK – An object with the route analysis results.
  • 401 Unauthorized – API key is invalid.
  • 403 Forbidden – The DC ID specified does not belong to the account API Key.
  • 404 Not Found – The Route ID is invalid or the Route Analytics are not yet available

Example response

{
  "status": "success",
  "data": {
    "route_analytics": {[
      "dc_id": "2123",
      "dc_name": "My DC",
      ...
    ], ...}
  }
}
GET /analytics/download-requests/(download_request_txid)/files
Parameters:
  • download_request_txid (string) – The transaction ID returned when creating an analytics download request.
Status Codes:
  • 200 OK – list of object(s) containing file data.
  • 202 Accepted – files still pending generation, returning the same download request text id.
  • 400 Bad Request – Check error code within the response.
  • 401 Unauthorized – API key is invalid.
Error Code Description
6000 Invalid Request Transaction ID

Example response

{
  "status": "success",
  "data": {
    "download_request_files": [
      {
        "file_type": "CSV",
        "download_link": "https://foxtrotsystems.com/files/5d35htaa04a8f942f7",
        "expiration_timestamp": 1483287694000,
        "download_type": "ROUTE_ANALYTICS",
      }, ...
    ]
  }
}
Property Type Nullable Description
file_type string false File type, i.e. CSV
download_link string false Link to download files
expiration_timestamp string false Expiration date for files
download_type string false Data that you are downloading, i.e. Attempt Analytics

Response FAQ

Why am I getting back a download_request_txid?

If you receive your download_request_txid as a response, this means the files are still being generated.