Create a pickup
Creates a pickup object. This request is for a carrier to come to a specified location to take a package for shipping.
curl https://api.goshippo.com/pickups/ \
-H "Authorization: ShippoToken <API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"carrier_account":"6c51273296864869829b96a80fb13ea1",
"location":{
"building_location_type": "Other",
"building_type": "suite",
"instructions": "Behind screen door",
"address": {
"name": "Mrs Hippo",
"company": "Hungry Hippos",
"street1": "965 Mission St #201",
"city": "San Francisco",
"state": "CA",
"zip": "95122",
"country": "US",
"phone": "+14159876543",
"email": "mrshippo@shippo.com"
}
},
"transactions": ["7439c279b374494c9a80ca24f59e6fc5"],
"requested_start_time":"2020-05-12T12:00:00Z",
"requested_end_time": "2020-05-12T16:00:00Z",
"metadata": "Customer ID 123456",
"is_test": false
}'import dateutil.parser
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header='ShippoToken <API_TOKEN>',
shippo_api_version='2018-02-08',
)
res = s.pickups.create(request=components.PickupBase(
carrier_account='adcfdddf8ec64b84ad22772bce3ea37a',
location=components.Location(
address=components.AddressCompleteCreateRequest(
name='Shwan Ippotle',
company='Shippo',
street1='215 Clayton St.',
street3='',
street_no='',
city='San Francisco',
state='CA',
zip='94117',
country='US',
phone='+1 555 341 9393',
email='shippotle@shippo.com',
is_residential=True,
metadata='Customer ID 123456',
validate=True,
),
building_location_type=components.BuildingLocationType.FRONT_DOOR,
building_type=components.BuildingType.APARTMENT,
instructions='Behind screen door',
),
requested_end_time=dateutil.parser.isoparse('2024-06-17T07:14:55.338Z'),
requested_start_time=dateutil.parser.isoparse('2024-11-30T17:06:07.804Z'),
transactions=[
'adcfdddf8ec64b84ad22772bce3ea37a',
],
))
if res is not None:
# handle response
passimport { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.pickups.create({
carrierAccount: "adcfdddf8ec64b84ad22772bce3ea37a",
location: {
address: {
name: "Shwan Ippotle",
company: "Shippo",
street1: "215 Clayton St.",
street3: "",
streetNo: "",
city: "San Francisco",
state: "CA",
zip: "94117",
country: "US",
phone: "+1 555 341 9393",
email: "shippotle@shippo.com",
isResidential: true,
metadata: "Customer ID 123456",
validate: true,
},
buildingLocationType: "Front Door",
buildingType: "apartment",
instructions: "Behind screen door",
},
requestedEndTime: new Date("2024-06-17T07:14:55.338Z"),
requestedStartTime: new Date("2024-11-30T17:06:07.804Z"),
transactions: [
"adcfdddf8ec64b84ad22772bce3ea37a",
],
});
// Handle the result
console.log(result);
}
run();using Shippo;
using Shippo.Models.Components;
using System;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Pickups.CreateAsync(
pickupBase: new PickupBase() {
CarrierAccount = "adcfdddf8ec64b84ad22772bce3ea37a",
Location = new Location() {
Address = new AddressCompleteCreateRequest() {
Name = "Shwan Ippotle",
Company = "Shippo",
Street1 = "215 Clayton St.",
Street3 = "",
StreetNo = "",
City = "San Francisco",
State = "CA",
Zip = "94117",
Country = "US",
Phone = "+1 555 341 9393",
Email = "shippotle@shippo.com",
IsResidential = true,
Metadata = "Customer ID 123456",
Validate = true,
},
BuildingLocationType = BuildingLocationType.FrontDoor,
BuildingType = BuildingType.Apartment,
Instructions = "Behind screen door",
},
RequestedEndTime = System.DateTime.Parse("2024-06-17T07:14:55.338Z"),
RequestedStartTime = System.DateTime.Parse("2024-11-30T17:06:07.804Z"),
Transactions = new List<string>() {
"adcfdddf8ec64b84ad22772bce3ea37a",
},
},
shippoApiVersion: "2018-02-08"
);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
use Shippo\API\Utils;
$sdk = API\Shippo::builder()
->setSecurity(
'ShippoToken <API_TOKEN>'
)
->setShippoApiVersion('2018-02-08')
->build();
$pickupBase = new Components\PickupBase(
carrierAccount: 'adcfdddf8ec64b84ad22772bce3ea37a',
location: new Components\Location(
address: new Components\AddressCompleteCreateRequest(
name: 'Shwan Ippotle',
company: 'Shippo',
street1: '215 Clayton St.',
street3: '',
streetNo: '',
city: 'San Francisco',
state: 'CA',
zip: '94117',
country: 'US',
phone: '+1 555 341 9393',
email: 'shippotle@shippo.com',
isResidential: true,
metadata: 'Customer ID 123456',
validate: true,
),
buildingLocationType: Components\BuildingLocationType::FrontDoor,
buildingType: Components\BuildingType::Apartment,
instructions: 'Behind screen door',
),
requestedEndTime: Utils\Utils::parseDateTime('2024-06-17T07:14:55.338Z'),
requestedStartTime: Utils\Utils::parseDateTime('2024-11-30T17:06:07.804Z'),
transactions: [
'adcfdddf8ec64b84ad22772bce3ea37a',
],
);
$response = $sdk->pickups->create(
pickupBase: $pickupBase,
shippoApiVersion: '2018-02-08'
);
if ($response->pickup !== null) {
// handle response
}package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.AddressCompleteCreateRequest;
import com.goshippo.shippo_sdk.models.components.BuildingLocationType;
import com.goshippo.shippo_sdk.models.components.BuildingType;
import com.goshippo.shippo_sdk.models.components.Location;
import com.goshippo.shippo_sdk.models.components.PickupBase;
import com.goshippo.shippo_sdk.models.operations.CreatePickupResponse;
import java.lang.Exception;
import java.time.OffsetDateTime;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken <API_TOKEN>")
.shippoApiVersion("2018-02-08")
.build();
CreatePickupResponse res = sdk.pickups().create()
.shippoApiVersion("2018-02-08")
.pickupBase(PickupBase.builder()
.carrierAccount("adcfdddf8ec64b84ad22772bce3ea37a")
.location(Location.builder()
.address(AddressCompleteCreateRequest.builder()
.name("Shwan Ippotle")
.street1("215 Clayton St.")
.city("San Francisco")
.state("CA")
.zip("94117")
.country("US")
.company("Shippo")
.street3("")
.streetNo("")
.phone("+1 555 341 9393")
.email("shippotle@shippo.com")
.isResidential(true)
.metadata("Customer ID 123456")
.validate(true)
.build())
.buildingLocationType(BuildingLocationType.FRONT_DOOR)
.buildingType(BuildingType.APARTMENT)
.instructions("Behind screen door")
.build())
.requestedEndTime(OffsetDateTime.parse("2024-06-17T07:14:55.338Z"))
.requestedStartTime(OffsetDateTime.parse("2024-11-30T17:06:07.804Z"))
.transactions(List.of(
"adcfdddf8ec64b84ad22772bce3ea37a"))
.build())
.call();
if (res.pickup().isPresent()) {
// handle response
}
}
}const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
carrier_account: 'adcfdddf8ec64b84ad22772bce3ea37a',
location: {
address: {
name: 'Shwan Ippotle',
street1: '215 Clayton St.',
city: 'San Francisco',
state: 'CA',
zip: '94117',
country: 'US',
company: 'Shippo',
street2: '<string>',
street3: '',
street_no: '',
phone: '+1 555 341 9393',
email: 'shippotle@shippo.com',
is_residential: true,
metadata: 'Customer ID 123456',
validate: true
},
building_location_type: 'Front Door',
building_type: 'apartment',
instructions: 'Behind screen door'
},
requested_end_time: '2023-11-07T05:31:56Z',
requested_start_time: '2023-11-07T05:31:56Z',
transactions: ['adcfdddf8ec64b84ad22772bce3ea37a'],
metadata: '<string>'
})
};
fetch('https://api.goshippo.com/pickups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goshippo.com/pickups"
payload := strings.NewReader("{\n \"carrier_account\": \"adcfdddf8ec64b84ad22772bce3ea37a\",\n \"location\": {\n \"address\": {\n \"name\": \"Shwan Ippotle\",\n \"street1\": \"215 Clayton St.\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"zip\": \"94117\",\n \"country\": \"US\",\n \"company\": \"Shippo\",\n \"street2\": \"<string>\",\n \"street3\": \"\",\n \"street_no\": \"\",\n \"phone\": \"+1 555 341 9393\",\n \"email\": \"shippotle@shippo.com\",\n \"is_residential\": true,\n \"metadata\": \"Customer ID 123456\",\n \"validate\": true\n },\n \"building_location_type\": \"Front Door\",\n \"building_type\": \"apartment\",\n \"instructions\": \"Behind screen door\"\n },\n \"requested_end_time\": \"2023-11-07T05:31:56Z\",\n \"requested_start_time\": \"2023-11-07T05:31:56Z\",\n \"transactions\": [\n \"adcfdddf8ec64b84ad22772bce3ea37a\"\n ],\n \"metadata\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.goshippo.com/pickups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"carrier_account\": \"adcfdddf8ec64b84ad22772bce3ea37a\",\n \"location\": {\n \"address\": {\n \"name\": \"Shwan Ippotle\",\n \"street1\": \"215 Clayton St.\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"zip\": \"94117\",\n \"country\": \"US\",\n \"company\": \"Shippo\",\n \"street2\": \"<string>\",\n \"street3\": \"\",\n \"street_no\": \"\",\n \"phone\": \"+1 555 341 9393\",\n \"email\": \"shippotle@shippo.com\",\n \"is_residential\": true,\n \"metadata\": \"Customer ID 123456\",\n \"validate\": true\n },\n \"building_location_type\": \"Front Door\",\n \"building_type\": \"apartment\",\n \"instructions\": \"Behind screen door\"\n },\n \"requested_end_time\": \"2023-11-07T05:31:56Z\",\n \"requested_start_time\": \"2023-11-07T05:31:56Z\",\n \"transactions\": [\n \"adcfdddf8ec64b84ad22772bce3ea37a\"\n ],\n \"metadata\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"carrier_account": "adcfdddf8ec64b84ad22772bce3ea37a",
"location": {
"address": {
"name": "Shwan Ippotle",
"street1": "215 Clayton St.",
"city": "San Francisco",
"state": "CA",
"zip": "94117",
"country": "US",
"company": "Shippo",
"street2": "<string>",
"street3": "",
"street_no": "",
"phone": "+1 555 341 9393",
"email": "shippotle@shippo.com",
"is_residential": true,
"metadata": "Customer ID 123456",
"validate": true
},
"building_location_type": "Front Door",
"building_type": "apartment",
"instructions": "Behind screen door"
},
"requested_end_time": "2023-11-07T05:31:56Z",
"requested_start_time": "2023-11-07T05:31:56Z",
"transactions": [
"adcfdddf8ec64b84ad22772bce3ea37a"
],
"metadata": "<string>",
"object_created": "2023-11-07T05:31:56Z",
"object_id": "<string>",
"object_updated": "2023-11-07T05:31:56Z",
"confirmed_start_time": "2020-05-09T12:00:00Z",
"confirmed_end_time": "2020-05-09T23:59:59.999Z",
"cancel_by_time": "2020-05-09T08:00:00Z",
"status": "CONFIRMED",
"confirmation_code": "WTC310058750",
"timezone": "US/Pacific",
"messages": [],
"is_test": true
}{}Authorizations
Headers
Optional string used to pick a non-default API version to use. See our API version guide.
"2018-02-08"
Optional. The object ID of a Managed Shippo Account. Platform accounts set this to make the request on behalf of one of their managed accounts. See the Platform accounts guide.
Body
Shippo’s pickups endpoint allows you to schedule pickups with USPS and DHL Express for eligible shipments that you have already created.
The object ID of your USPS or DHL Express carrier account. You can retrieve this from your Rate requests or our Carrier Accounts endpoint.
"adcfdddf8ec64b84ad22772bce3ea37a"
Response
Pickup
The object ID of your USPS or DHL Express carrier account. You can retrieve this from your Rate requests or our Carrier Accounts endpoint.
"adcfdddf8ec64b84ad22772bce3ea37a"
Was this page helpful?
curl https://api.goshippo.com/pickups/ \
-H "Authorization: ShippoToken <API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"carrier_account":"6c51273296864869829b96a80fb13ea1",
"location":{
"building_location_type": "Other",
"building_type": "suite",
"instructions": "Behind screen door",
"address": {
"name": "Mrs Hippo",
"company": "Hungry Hippos",
"street1": "965 Mission St #201",
"city": "San Francisco",
"state": "CA",
"zip": "95122",
"country": "US",
"phone": "+14159876543",
"email": "mrshippo@shippo.com"
}
},
"transactions": ["7439c279b374494c9a80ca24f59e6fc5"],
"requested_start_time":"2020-05-12T12:00:00Z",
"requested_end_time": "2020-05-12T16:00:00Z",
"metadata": "Customer ID 123456",
"is_test": false
}'import dateutil.parser
import shippo
from shippo.models import components
s = shippo.Shippo(
api_key_header='ShippoToken <API_TOKEN>',
shippo_api_version='2018-02-08',
)
res = s.pickups.create(request=components.PickupBase(
carrier_account='adcfdddf8ec64b84ad22772bce3ea37a',
location=components.Location(
address=components.AddressCompleteCreateRequest(
name='Shwan Ippotle',
company='Shippo',
street1='215 Clayton St.',
street3='',
street_no='',
city='San Francisco',
state='CA',
zip='94117',
country='US',
phone='+1 555 341 9393',
email='shippotle@shippo.com',
is_residential=True,
metadata='Customer ID 123456',
validate=True,
),
building_location_type=components.BuildingLocationType.FRONT_DOOR,
building_type=components.BuildingType.APARTMENT,
instructions='Behind screen door',
),
requested_end_time=dateutil.parser.isoparse('2024-06-17T07:14:55.338Z'),
requested_start_time=dateutil.parser.isoparse('2024-11-30T17:06:07.804Z'),
transactions=[
'adcfdddf8ec64b84ad22772bce3ea37a',
],
))
if res is not None:
# handle response
passimport { Shippo } from "shippo";
const shippo = new Shippo({
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08",
});
async function run() {
const result = await shippo.pickups.create({
carrierAccount: "adcfdddf8ec64b84ad22772bce3ea37a",
location: {
address: {
name: "Shwan Ippotle",
company: "Shippo",
street1: "215 Clayton St.",
street3: "",
streetNo: "",
city: "San Francisco",
state: "CA",
zip: "94117",
country: "US",
phone: "+1 555 341 9393",
email: "shippotle@shippo.com",
isResidential: true,
metadata: "Customer ID 123456",
validate: true,
},
buildingLocationType: "Front Door",
buildingType: "apartment",
instructions: "Behind screen door",
},
requestedEndTime: new Date("2024-06-17T07:14:55.338Z"),
requestedStartTime: new Date("2024-11-30T17:06:07.804Z"),
transactions: [
"adcfdddf8ec64b84ad22772bce3ea37a",
],
});
// Handle the result
console.log(result);
}
run();using Shippo;
using Shippo.Models.Components;
using System;
using System.Collections.Generic;
var sdk = new ShippoSDK(
apiKeyHeader: "ShippoToken <API_TOKEN>",
shippoApiVersion: "2018-02-08"
);
var res = await sdk.Pickups.CreateAsync(
pickupBase: new PickupBase() {
CarrierAccount = "adcfdddf8ec64b84ad22772bce3ea37a",
Location = new Location() {
Address = new AddressCompleteCreateRequest() {
Name = "Shwan Ippotle",
Company = "Shippo",
Street1 = "215 Clayton St.",
Street3 = "",
StreetNo = "",
City = "San Francisco",
State = "CA",
Zip = "94117",
Country = "US",
Phone = "+1 555 341 9393",
Email = "shippotle@shippo.com",
IsResidential = true,
Metadata = "Customer ID 123456",
Validate = true,
},
BuildingLocationType = BuildingLocationType.FrontDoor,
BuildingType = BuildingType.Apartment,
Instructions = "Behind screen door",
},
RequestedEndTime = System.DateTime.Parse("2024-06-17T07:14:55.338Z"),
RequestedStartTime = System.DateTime.Parse("2024-11-30T17:06:07.804Z"),
Transactions = new List<string>() {
"adcfdddf8ec64b84ad22772bce3ea37a",
},
},
shippoApiVersion: "2018-02-08"
);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use Shippo\API;
use Shippo\API\Models\Components;
use Shippo\API\Utils;
$sdk = API\Shippo::builder()
->setSecurity(
'ShippoToken <API_TOKEN>'
)
->setShippoApiVersion('2018-02-08')
->build();
$pickupBase = new Components\PickupBase(
carrierAccount: 'adcfdddf8ec64b84ad22772bce3ea37a',
location: new Components\Location(
address: new Components\AddressCompleteCreateRequest(
name: 'Shwan Ippotle',
company: 'Shippo',
street1: '215 Clayton St.',
street3: '',
streetNo: '',
city: 'San Francisco',
state: 'CA',
zip: '94117',
country: 'US',
phone: '+1 555 341 9393',
email: 'shippotle@shippo.com',
isResidential: true,
metadata: 'Customer ID 123456',
validate: true,
),
buildingLocationType: Components\BuildingLocationType::FrontDoor,
buildingType: Components\BuildingType::Apartment,
instructions: 'Behind screen door',
),
requestedEndTime: Utils\Utils::parseDateTime('2024-06-17T07:14:55.338Z'),
requestedStartTime: Utils\Utils::parseDateTime('2024-11-30T17:06:07.804Z'),
transactions: [
'adcfdddf8ec64b84ad22772bce3ea37a',
],
);
$response = $sdk->pickups->create(
pickupBase: $pickupBase,
shippoApiVersion: '2018-02-08'
);
if ($response->pickup !== null) {
// handle response
}package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.AddressCompleteCreateRequest;
import com.goshippo.shippo_sdk.models.components.BuildingLocationType;
import com.goshippo.shippo_sdk.models.components.BuildingType;
import com.goshippo.shippo_sdk.models.components.Location;
import com.goshippo.shippo_sdk.models.components.PickupBase;
import com.goshippo.shippo_sdk.models.operations.CreatePickupResponse;
import java.lang.Exception;
import java.time.OffsetDateTime;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("ShippoToken <API_TOKEN>")
.shippoApiVersion("2018-02-08")
.build();
CreatePickupResponse res = sdk.pickups().create()
.shippoApiVersion("2018-02-08")
.pickupBase(PickupBase.builder()
.carrierAccount("adcfdddf8ec64b84ad22772bce3ea37a")
.location(Location.builder()
.address(AddressCompleteCreateRequest.builder()
.name("Shwan Ippotle")
.street1("215 Clayton St.")
.city("San Francisco")
.state("CA")
.zip("94117")
.country("US")
.company("Shippo")
.street3("")
.streetNo("")
.phone("+1 555 341 9393")
.email("shippotle@shippo.com")
.isResidential(true)
.metadata("Customer ID 123456")
.validate(true)
.build())
.buildingLocationType(BuildingLocationType.FRONT_DOOR)
.buildingType(BuildingType.APARTMENT)
.instructions("Behind screen door")
.build())
.requestedEndTime(OffsetDateTime.parse("2024-06-17T07:14:55.338Z"))
.requestedStartTime(OffsetDateTime.parse("2024-11-30T17:06:07.804Z"))
.transactions(List.of(
"adcfdddf8ec64b84ad22772bce3ea37a"))
.build())
.call();
if (res.pickup().isPresent()) {
// handle response
}
}
}const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
carrier_account: 'adcfdddf8ec64b84ad22772bce3ea37a',
location: {
address: {
name: 'Shwan Ippotle',
street1: '215 Clayton St.',
city: 'San Francisco',
state: 'CA',
zip: '94117',
country: 'US',
company: 'Shippo',
street2: '<string>',
street3: '',
street_no: '',
phone: '+1 555 341 9393',
email: 'shippotle@shippo.com',
is_residential: true,
metadata: 'Customer ID 123456',
validate: true
},
building_location_type: 'Front Door',
building_type: 'apartment',
instructions: 'Behind screen door'
},
requested_end_time: '2023-11-07T05:31:56Z',
requested_start_time: '2023-11-07T05:31:56Z',
transactions: ['adcfdddf8ec64b84ad22772bce3ea37a'],
metadata: '<string>'
})
};
fetch('https://api.goshippo.com/pickups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goshippo.com/pickups"
payload := strings.NewReader("{\n \"carrier_account\": \"adcfdddf8ec64b84ad22772bce3ea37a\",\n \"location\": {\n \"address\": {\n \"name\": \"Shwan Ippotle\",\n \"street1\": \"215 Clayton St.\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"zip\": \"94117\",\n \"country\": \"US\",\n \"company\": \"Shippo\",\n \"street2\": \"<string>\",\n \"street3\": \"\",\n \"street_no\": \"\",\n \"phone\": \"+1 555 341 9393\",\n \"email\": \"shippotle@shippo.com\",\n \"is_residential\": true,\n \"metadata\": \"Customer ID 123456\",\n \"validate\": true\n },\n \"building_location_type\": \"Front Door\",\n \"building_type\": \"apartment\",\n \"instructions\": \"Behind screen door\"\n },\n \"requested_end_time\": \"2023-11-07T05:31:56Z\",\n \"requested_start_time\": \"2023-11-07T05:31:56Z\",\n \"transactions\": [\n \"adcfdddf8ec64b84ad22772bce3ea37a\"\n ],\n \"metadata\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.goshippo.com/pickups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"carrier_account\": \"adcfdddf8ec64b84ad22772bce3ea37a\",\n \"location\": {\n \"address\": {\n \"name\": \"Shwan Ippotle\",\n \"street1\": \"215 Clayton St.\",\n \"city\": \"San Francisco\",\n \"state\": \"CA\",\n \"zip\": \"94117\",\n \"country\": \"US\",\n \"company\": \"Shippo\",\n \"street2\": \"<string>\",\n \"street3\": \"\",\n \"street_no\": \"\",\n \"phone\": \"+1 555 341 9393\",\n \"email\": \"shippotle@shippo.com\",\n \"is_residential\": true,\n \"metadata\": \"Customer ID 123456\",\n \"validate\": true\n },\n \"building_location_type\": \"Front Door\",\n \"building_type\": \"apartment\",\n \"instructions\": \"Behind screen door\"\n },\n \"requested_end_time\": \"2023-11-07T05:31:56Z\",\n \"requested_start_time\": \"2023-11-07T05:31:56Z\",\n \"transactions\": [\n \"adcfdddf8ec64b84ad22772bce3ea37a\"\n ],\n \"metadata\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"carrier_account": "adcfdddf8ec64b84ad22772bce3ea37a",
"location": {
"address": {
"name": "Shwan Ippotle",
"street1": "215 Clayton St.",
"city": "San Francisco",
"state": "CA",
"zip": "94117",
"country": "US",
"company": "Shippo",
"street2": "<string>",
"street3": "",
"street_no": "",
"phone": "+1 555 341 9393",
"email": "shippotle@shippo.com",
"is_residential": true,
"metadata": "Customer ID 123456",
"validate": true
},
"building_location_type": "Front Door",
"building_type": "apartment",
"instructions": "Behind screen door"
},
"requested_end_time": "2023-11-07T05:31:56Z",
"requested_start_time": "2023-11-07T05:31:56Z",
"transactions": [
"adcfdddf8ec64b84ad22772bce3ea37a"
],
"metadata": "<string>",
"object_created": "2023-11-07T05:31:56Z",
"object_id": "<string>",
"object_updated": "2023-11-07T05:31:56Z",
"confirmed_start_time": "2020-05-09T12:00:00Z",
"confirmed_end_time": "2020-05-09T23:59:59.999Z",
"cancel_by_time": "2020-05-09T08:00:00Z",
"status": "CONFIRMED",
"confirmation_code": "WTC310058750",
"timezone": "US/Pacific",
"messages": [],
"is_test": true
}{}