Operation Page Breadcrumb

Developer APIs Order Scheduling API

Order Scheduling API

List Survey Records

List surveys based on filter criteria.

Try it

Request

Request URL

Request parameters

  • (optional)
    string

    Filter surveys by line of business.

  • (optional)
    string

    Filter surveys by survey name.

Request headers

  • string
    Subscription key which provides access to this API. Found in your Profile.
  • string
    OAuth 2.0 access token obtained from JB Hunt OAuth 2.0 Provider (RHSSO - Security360). Supported grant types: Authorization code.

Request body

Responses

200 OK

Retrieved survey records.

Representations

{
  "surveys": [
    {
      "surveyId": "string",
      "questions": {
        "surveyQuestions": [
          {
            "questionId": "string",
            "validAnswers": {
              "surveyQuestionValidAnswers": [
                {
                  "questionId": "string",
                  "sequence": 0,
                  "value": "string",
                  "description": "string",
                  "hardStop": "string",
                  "commentCategory": "string",
                  "serviceTriggers": [
                    {
                      "serviceSKU": "MOVELVTR10",
                      "triggerType": "Range",
                      "value": "string",
                      "minValue": "2",
                      "maxValue": "10"
                    }
                  ]
                }
              ]
            },
            "answerContingencies": {
              "surveyQuestionContingencyAnswers": [
                {
                  "contingencyId": "string",
                  "contingencyQuestionId": "string",
                  "responseValue": "string"
                }
              ]
            },
            "surveyId": "string",
            "responseType": "string",
            "sequence": 0,
            "required": true,
            "text": "string"
          }
        ]
      },
      "description": "string",
      "surveyName": "string",
      "callCenterCode": "string",
      "companyCode": "string",
      "departmentCode": "string",
      "divisionCode": "string"
    }
  ]
}
{
  "title": "Survey Query Response",
  "type": "object",
  "properties": {
    "surveys": {
      "type": "array",
      "items": {
        "allOf": [
          {
            "title": "Survey",
            "type": "object",
            "properties": {
              "description": {
                "type": "string",
                "description": "Description of survey."
              },
              "surveyName": {
                "type": "string",
                "description": "Name of survey."
              },
              "callCenterCode": {
                "type": "string",
                "description": "Call center code."
              },
              "companyCode": {
                "type": "string",
                "description": "Company code."
              },
              "departmentCode": {
                "type": "string",
                "description": "Department code."
              },
              "divisionCode": {
                "type": "string",
                "description": "Division code."
              }
            },
            "description": "Survey."
          }
        ],
        "properties": {
          "surveyId": {
            "type": "string",
            "description": "ID of survey."
          },
          "questions": {
            "title": "Survey Questions",
            "allOf": [
              {
                "title": "Survey Question Query Response",
                "type": "object",
                "properties": {
                  "surveyQuestions": {
                    "type": "array",
                    "items": {
                      "allOf": [
                        {
                          "title": "Survey Question",
                          "type": "object",
                          "properties": {
                            "surveyId": {
                              "type": "string",
                              "description": "ID of survey."
                            },
                            "responseType": {
                              "type": "string",
                              "description": "Definition of response type."
                            },
                            "sequence": {
                              "type": "integer",
                              "description": "Sequence of question display."
                            },
                            "required": {
                              "type": "boolean",
                              "description": "Required question flag."
                            },
                            "text": {
                              "type": "string",
                              "description": "Question text."
                            }
                          },
                          "description": "Survey question."
                        }
                      ],
                      "properties": {
                        "questionId": {
                          "type": "string",
                          "description": "ID of survey."
                        },
                        "validAnswers": {
                          "title": "Survey Question Valid Answers",
                          "allOf": [
                            {
                              "title": "Survey Question Valid Answer Query Response",
                              "type": "object",
                              "properties": {
                                "surveyQuestionValidAnswers": {
                                  "type": "array",
                                  "items": {
                                    "allOf": [
                                      {
                                        "title": "Survey Question Valid Answer",
                                        "type": "object",
                                        "properties": {
                                          "sequence": {
                                            "type": "integer",
                                            "description": "Sequence of valid answer display."
                                          },
                                          "value": {
                                            "type": "string",
                                            "description": "Valid answer value."
                                          },
                                          "description": {
                                            "type": "string",
                                            "description": "Description of valid answer."
                                          },
                                          "hardStop": {
                                            "type": "string",
                                            "description": "Survey hardstop indicator for answer used to block the customer from proceding with survey due to various reasons that can impact the delivery like - Health Risk, Operations, Natural Disaster, etc."
                                          },
                                          "commentCategory": {
                                            "type": "string",
                                            "description": "Category of comment phrase to add to the order based on question response."
                                          },
                                          "serviceTriggers": {
                                            "type": "array",
                                            "items": {
                                              "allOf": [
                                                {
                                                  "title": "ServiceTrigger",
                                                  "type": "object",
                                                  "properties": {
                                                    "serviceSKU": {
                                                      "type": "string",
                                                      "description": "Service SKU to add with the order based on response.",
                                                      "example": "MOVELVTR10"
                                                    },
                                                    "triggerType": {
                                                      "enum": [
                                                        "Range",
                                                        "Specific"
                                                      ],
                                                      "type": "string",
                                                      "description": "Trigger type for service addition logic.",
                                                      "example": "Range"
                                                    },
                                                    "value": {
                                                      "type": "string",
                                                      "description": "Response value for trigger of service addition logic."
                                                    },
                                                    "minValue": {
                                                      "type": "string",
                                                      "description": "Minimum range response value for trigger of service addition logic.",
                                                      "example": "2"
                                                    },
                                                    "maxValue": {
                                                      "type": "string",
                                                      "description": "Maximum range response value for trigger of service addition logic.",
                                                      "example": "10"
                                                    }
                                                  },
                                                  "description": "Service Trigger object to add the service with the order based on response."
                                                }
                                              ]
                                            },
                                            "description": "Service SKUs to add to the order product based on question response."
                                          }
                                        },
                                        "description": "Valid answers for a survey question."
                                      }
                                    ],
                                    "properties": {
                                      "questionId": {
                                        "type": "string",
                                        "description": "Question identifier."
                                      }
                                    }
                                  },
                                  "description": "Result set of survey question records."
                                }
                              },
                              "description": "List of survey question valid answers returned from a search or listing."
                            }
                          ],
                          "description": "Valid answers for a survey question."
                        },
                        "answerContingencies": {
                          "title": "Survey Question Answer Contingencies",
                          "allOf": [
                            {
                              "title": "Survey Question Contingency Answer Query Response",
                              "type": "object",
                              "properties": {
                                "surveyQuestionContingencyAnswers": {
                                  "type": "array",
                                  "items": {
                                    "allOf": [
                                      {
                                        "title": "Survey Question Contingency Answer",
                                        "type": "object",
                                        "properties": {
                                          "contingencyQuestionId": {
                                            "type": "string",
                                            "description": "Contingency question identifier."
                                          },
                                          "responseValue": {
                                            "type": "string",
                                            "description": "Response to trigger contingency question."
                                          }
                                        },
                                        "description": "Contingent answers for a survey question."
                                      }
                                    ],
                                    "properties": {
                                      "contingencyId": {
                                        "type": "string",
                                        "description": "ID of contingency constraint."
                                      }
                                    }
                                  },
                                  "description": "Result set of survey answer contingency records."
                                }
                              },
                              "description": "List of answer contingencies for a survey question."
                            }
                          ],
                          "description": "Answer contingency for survey question."
                        }
                      }
                    },
                    "description": "Result set of survey question records."
                  }
                },
                "description": "List of surveys returned from a search or listing."
              }
            ],
            "description": "Questions contained in survey."
          }
        }
      },
      "description": "Result set of survey records."
    }
  },
  "description": "List of surveys returned from a search or listing."
}

400 Bad Request

Cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). See RFC 7231, Section 6.5.1.

Representations

{
  "type": "about:blank",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "dateTime": {},
  "issues": [
    {
      "description": "string",
      "field": {},
      "location": "body",
      "value": {}
    }
  ]
}
{
  "title": "Problem Details",
  "allOf": [
    {
      "title": "Core Problem Details",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "A [URI reference](https://tools.ietf.org/html/rfc3986#section-4.1) that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using [HTML](https://www.w3.org/TR/2014/REC-html5-20141028)). When this member is not present, its value is assumed to be `\"about:blank\"`.",
          "default": "about:blank"
        },
        "title": {
          "type": "string",
          "description": "A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization (e.g., using proactive [content negotiation](https://tools.ietf.org/html/rfc7231#section-3.4))."
        },
        "status": {
          "maximum": 600.0,
          "exclusiveMaximum": true,
          "minimum": 100.0,
          "type": "integer",
          "description": "The [HTTP status code](https://tools.ietf.org/html/rfc7231#section-6) generated by the origin server for this occurrence of the problem."
        },
        "detail": {
          "type": "string",
          "description": "A human-readable explanation specific to this occurrence of the problem."
        },
        "instance": {
          "type": "string",
          "description": "A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced."
        }
      },
      "description": "The core problem details object. See [Section 3.1 of RFC 7807](https://tools.ietf.org/html/rfc7807#section-3.1)."
    },
    {
      "title": "Problem Details Extensions",
      "type": "object",
      "properties": {
        "dateTime": {
          "allOf": [
            {
              "title": "Date Time",
              "type": "string",
              "description": "As defined by `date-time` in [Section 5.6 of RFC 3339](https://tools.ietf.org/html/rfc3339#section-5.6)",
              "format": "date-time"
            }
          ],
          "description": "The date and time that the problem occurred."
        },
        "issues": {
          "type": "array",
          "items": {
            "title": "Issue",
            "required": [
              "description",
              "field",
              "location"
            ],
            "type": "object",
            "properties": {
              "description": {
                "type": "string",
                "description": "A human-readable explanation of the specific issue."
              },
              "field": {
                "anyOf": [
                  {
                    "title": "JSON Pointer",
                    "pattern": "^(\\/([^/~]|~[01])*)*$",
                    "type": "string",
                    "description": "A string representing a JSON Pointer as defined by [RFC 6901](https://tools.ietf.org/html/rfc6901)."
                  },
                  {
                    "type": "string"
                  }
                ],
                "description": "The name of the field in error. If `location` is `body`, then this MUST be either a [JSON pointer](https://tools.ietf.org/html/rfc6901) or an [XPath expression](https://www.w3.org/TR/1999/REC-xpath-19991116) referring to the field of the body."
              },
              "location": {
                "enum": [
                  "body",
                  "header",
                  "path",
                  "query"
                ],
                "type": "string",
                "description": "The location of the issue.",
                "default": "body"
              },
              "value": {
                "allOf": [
                  {
                    "title": "Any?",
                    "allOf": [
                      {
                        "title": "Any",
                        "oneOf": [
                          {
                            "title": "Any Primitive",
                            "oneOf": [
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "string"
                              }
                            ],
                            "description": "Any non-nullable primitive JSON value"
                          },
                          {
                            "title": "Any Structured Value",
                            "oneOf": [
                              {
                                "type": "array"
                              },
                              {
                                "type": "object"
                              }
                            ],
                            "description": "Any non-nullable structured JSON value"
                          }
                        ],
                        "description": "Any non-nullable JSON value"
                      }
                    ],
                    "description": "Any nullable JSON value",
                    "nullable": true
                  }
                ],
                "description": "The value of the field in error."
              }
            },
            "description": "An object describing the issue of a particular field in an HTTP request message."
          },
          "description": "An array of issues related to specific fields in the HTTP request message."
        }
      },
      "description": "Custom J.B. Hunt extensions to the problems details format"
    }
  ],
  "description": "The [Problem Details for HTTP APIs](https://tools.ietf.org/html/rfc7807) format with extensions."
}

Code samples

@ECHO OFF

curl -v -X GET "https://api.jbhunt.com/order-scheduling/surveys?lineOfBusiness={string}&surveyName={string}"
-H "Api-Key: {subscription key}"
-H "Authorization: {access token}"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("Api-Key", "{subscription key}");
            client.DefaultRequestHeaders.Add("Authorization", "{access token}");

            // Request parameters
            queryString["lineOfBusiness"] = "{string}";
            queryString["surveyName"] = "{string}";
            var uri = "https://api.jbhunt.com/order-scheduling/surveys?" + queryString;

            var response = await client.GetAsync(uri);
        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://api.jbhunt.com/order-scheduling/surveys");

            builder.setParameter("lineOfBusiness", "{string}");
            builder.setParameter("surveyName", "{string}");

            URI uri = builder.build();
            HttpGet request = new HttpGet(uri);
            request.setHeader("Api-Key", "{subscription key}");
            request.setHeader("Authorization", "{access token}");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
            "lineOfBusiness": "{string}",
            "surveyName": "{string}",
        };
      
        $.ajax({
            url: "https://api.jbhunt.com/order-scheduling/surveys?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("Api-Key","{subscription key}");
                xhrObj.setRequestHeader("Authorization","{access token}");
            },
            type: "GET",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://api.jbhunt.com/order-scheduling/surveys";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                         @"lineOfBusiness={string}",
                         @"surveyName={string}",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    // Request headers
    [_request setValue:@"{subscription key}" forHTTPHeaderField:@"Api-Key"];
    [_request setValue:@"{access token}" forHTTPHeaderField:@"Authorization"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://api.jbhunt.com/order-scheduling/surveys');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'Api-Key' => '{subscription key}',
    'Authorization' => '{access token}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
    'lineOfBusiness' => '{string}',
    'surveyName' => '{string}',
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_GET);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'Api-Key': '{subscription key}',
    'Authorization': '{access token}',
}

params = urllib.urlencode({
    # Request parameters
    'lineOfBusiness': '{string}',
    'surveyName': '{string}',
})

try:
    conn = httplib.HTTPSConnection('api.jbhunt.com')
    conn.request("GET", "/order-scheduling/surveys?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'Api-Key': '{subscription key}',
    'Authorization': '{access token}',
}

params = urllib.parse.urlencode({
    # Request parameters
    'lineOfBusiness': '{string}',
    'surveyName': '{string}',
})

try:
    conn = http.client.HTTPSConnection('api.jbhunt.com')
    conn.request("GET", "/order-scheduling/surveys?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://api.jbhunt.com/order-scheduling/surveys')

query = URI.encode_www_form({
    # Request parameters
    'lineOfBusiness' => '{string}',
    'surveyName' => '{string}'
})
if query.length > 0
  if uri.query && uri.query.length > 0
    uri.query += '&' + query
  else
    uri.query = query
  end
end

request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['Api-Key'] = '{subscription key}'
# Request headers
request['Authorization'] = '{access token}'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body