Service Points

Allows you to get the Service Points between two zip codes.
Get Service Points
HTTP Method: GET
URL: /ServicePoint
Request Parameters
Name Type Cardinality Required Description
ZipOrPostalCode string One Required for Countries that have zipcodes, optional for those that do not.
CountryCode string One Required ISO3 Country Code
Response Parameters
Name Type Cardinality Description
ServicePoints array One List of Service Points
Properties
ServicePoint object Zero or More Service point
Properties
City string One
StateOrProvince string
ZipOrPostalCode string
CountryCode string One ISO3 Country Code
Code integer One HTTP Status code
Errors array One Returned errors
Properties
Error object Zero or More
Properties
Property string One
ErrorMessage string One
ExceptionMessage string One
Messages array One Returned informational messages
Properties
Message string Zero or More
Example Request

require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{baseurl}/ServicePoint?CountryCode=USA&ZipOrPostalCode=45177');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'apiKey' => 'Your API Key',
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
using CallAPI.DataContracts.ServicePoints.Response;
using System.Net.Http;
using System.Net.Http.Headers;

namespace CallAPI
{
class ServicePointSample
{
string apiKey = "Your API Key";

//GET
public GetServicePointResponse GetServicePoints()
{
var response = new GetServicePointResponse();
var countryCode = "USA";
var zip = "45177";

var url = string.Format("{baseurl}/ServicePoint?CountryCode={0}&ZipOrPostalCode={1}", countryCode, zip);

using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("apiKey", apiKey);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

var apiResponse = client.GetAsync(url).Result;
response = apiResponse.Content.ReadAsAsync().Result;
}

return response;
}
}
}
package Samples;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;

import com.fasterxml.jackson.databind.ObjectMapper;

import DataContracts.ServicePoints.Response.GetServicePointResponse;

public class ServicePointSample {
String apiKey = "Your API Key";
ObjectMapper mapper = new ObjectMapper();

//GET
public GetServicePointResponse GetServicePoints() throws Exception {
GetServicePointResponse response = new GetServicePointResponse();

String url = "{baseurl}/ServicePoint";
String countryCode = "USA";
String zip = "45177";

url += "?CountryCode=" + countryCode + "&ZipOrPostalCode=" + zip;

HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet httprequest = new HttpGet(url);
httprequest.setHeader("apiKey", apiKey);

HttpResponse httpResponse = httpClient.execute(httprequest);

BufferedReader in = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent()));

String inputLine;
StringBuffer result = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
result.append(inputLine);
}
in.close();

response = mapper.readValue(result.toString(), GetServicePointResponse.class);

return response;
}
}