These docs are for v1.0. Click to read the latest docs for v2024.09.
curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --header "Authorization: Bearer 77af10e030c4fc85fc0738fbd5a8945722c261996ae2bfb5a0e5e974d591c83f" \
     --data-binary "{
  \"courier_id\": \"b4552ed2-ae95-4647-9746-5790bf252c7f\",
  \"preferred_date\": \"2016-12-08\",
  \"preferred_max_time\": \"2016-12-08T18:00\",
  \"preferred_min_time\": \"2016-12-08T09:00\",
  \"easyship_shipment_ids\": [
    \"ESUS3171766\"
  ]
}" \
'https://api.easyship.com/pickup/v1/pickups'
var request = require('request');

request({
  method: 'POST',
  url: 'https://api.easyship.com/pickup/v1/pickups',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer 77af10e030c4fc85fc0738fbd5a8945722c261996ae2bfb5a0e5e974d591c83f'
  },
  body: "{  \"courier_id\": \"b4552ed2-ae95-4647-9746-5790bf252c7f\",  \"preferred_date\": \"2016-12-08\",  \"preferred_max_time\": \"2016-12-08T18:00\",  \"preferred_min_time\": \"2016-12-08T09:00\",  \"easyship_shipment_ids\": [    \"ESUS3171766\"  ]}"
}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'

values = '{
  "courier_id": "b4552ed2-ae95-4647-9746-5790bf252c7f",
  "preferred_date": "2016-12-08",
  "preferred_max_time": "2016-12-08T18:00",
  "preferred_min_time": "2016-12-08T09:00",
  "easyship_shipment_ids": [
    "ESUS3171766"
  ]
}'

headers = {
  :content_type => 'application/json',
  :authorization => 'Bearer 77af10e030c4fc85fc0738fbd5a8945722c261996ae2bfb5a0e5e974d591c83f'
}

response = RestClient.post 'https://api.easyship.com/pickup/v1/pickups', values, headers
puts response
from urllib2 import Request, urlopen

values = """
  {
    "courier_id": "b4552ed2-ae95-4647-9746-5790bf252c7f",
    "preferred_date": "2016-12-08",
    "preferred_max_time": "2016-12-08T18:00",
    "preferred_min_time": "2016-12-08T09:00",
    "easyship_shipment_ids": [
      "ESUS3171766"
    ]
  }
"""

headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer 77af10e030c4fc85fc0738fbd5a8945722c261996ae2bfb5a0e5e974d591c83f'
}
request = Request('https://api.easyship.com/pickup/v1/pickups', data=values, headers=headers)

response_body = urlopen(request).read()
print response_body
<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.easyship.com/pickup/v1/pickups");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_POST, TRUE);

curl_setopt($ch, CURLOPT_POSTFIELDS, "{
  \"courier_id\": \"b4552ed2-ae95-4647-9746-5790bf252c7f\",
  \"preferred_date\": \"2016-12-08\",
  \"preferred_max_time\": \"2016-12-08T18:00\",
  \"preferred_min_time\": \"2016-12-08T09:00\",
  \"easyship_shipment_ids\": [
    \"ESUS3171766\"
  ]
}");

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/json",
  "Authorization: Bearer 77af10e030c4fc85fc0738fbd5a8945722c261996ae2bfb5a0e5e974d591c83f"
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
var request = new XMLHttpRequest();

request.open('POST', 'https://api.easyship.com/pickup/v1/pickups');

request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', 'Bearer 77af10e030c4fc85fc0738fbd5a8945722c261996ae2bfb5a0e5e974d591c83f');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

var body = {
  'courier_id': 'b4552ed2-ae95-4647-9746-5790bf252c7f',
  'preferred_date': '2016-12-08',
  'preferred_max_time': '2016-12-08T18:00',
  'preferred_min_time': '2016-12-08T09:00',
  'easyship_shipment_ids': [
    'ESUS3171766'
  ]
};

request.send(JSON.stringify(body));
##Response
{
    "courier_id": "b4552ed2-ae95-4647-9746-5790bf252c7f",
    "courier_name": "UPS",
    "easyship_shipment_ids": [
        "ESUS3171766"
    ],
    "pickup":
        {
            "easyship_pickup_id": "PHK0000001",
            "preferred_min_time": "2016-12-08T09:00",
            "preferred_max_time": "2016-12-08T18:00",
            "pickup_reference_number": "292494AGF4L",
          	"pickup_fee": "0.0",
            "provider_name": "UPS",
            "provider_customer_service_phone": "+1 2345 6789",
            "shipments_count": "1",
            "total_actual_weight": "1.0",
            "pickup_state": "requested",
            "address":
                {
                    "line_1": "123 Test Street",
                    "line_2": "Block 3",
                    "line_3": "Unit 1000",
                    "postal_code": "ABC123",
                    "city": "Hong Kong",
                    "state": null,
                    "country": "Hong Kong",
                    "contact_email": "[email protected]",
                    "contact_phone": "+852-1234-5678",
                    "company_name": "Test Plc.",
                    "contact_name": "Foo Bar",
                }
        }
}
Language
Credentials
Header
Click Try It! to start a request and see the response here!