Retrieves an EasyPost pickup
curl -X GET https://api.easypost.com/v2/pickups/pck_... \
-u <YOUR_TEST/PRODUCTION_API_KEY>:
var
rest: HCkRest;
success: Boolean;
bTls: Boolean;
port: Integer;
bAutoReconnect: Boolean;
sbResponseBody: HCkStringBuilder;
jsonResponse: HCkJsonObject;
id: PWideChar;
object: PWideChar;
created_at: PWideChar;
updated_at: PWideChar;
mode: PWideChar;
status: PWideChar;
reference: PWideChar;
min_datetime: PWideChar;
max_datetime: PWideChar;
is_account_address: Boolean;
instructions: PWideChar;
confirmation: Boolean;
addressId: PWideChar;
addressObject: PWideChar;
addressCreated_at: PWideChar;
addressUpdated_at: PWideChar;
addressName: PWideChar;
addressCompany: PWideChar;
addressStreet1: PWideChar;
addressStreet2: PWideChar;
addressCity: PWideChar;
addressState: PWideChar;
addressZip: PWideChar;
addressCountry: PWideChar;
addressPhone: PWideChar;
addressEmail: Boolean;
addressMode: PWideChar;
addressCarrier_facility: Boolean;
addressResidential: Boolean;
addressFederal_tax_id: Boolean;
addressState_tax_id: Boolean;
i: Integer;
count_i: Integer;
currency: PWideChar;
rate: PWideChar;
service: PWideChar;
carrier: PWideChar;
pickup_id: PWideChar;
begin
rest := CkRest_Create();
// URL: https://api.easypost.com/v2/pickups/pck_...
bTls := True;
port := 443;
bAutoReconnect := True;
success := CkRest_Connect(rest,'api.easypost.com',port,bTls,bAutoReconnect);
if (success <> True) then
begin
Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(CkRest_getConnectFailReason(rest)));
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
CkRest_SetAuthBasic(rest,'<YOUR_TEST/PRODUCTION_API_KEY>','');
sbResponseBody := CkStringBuilder_Create();
success := CkRest_FullRequestNoBodySb(rest,'GET','/v2/pickups/pck_...',sbResponseBody);
if (success <> True) then
begin
Memo1.Lines.Add(CkRest__lastErrorText(rest));
Exit;
end;
jsonResponse := CkJsonObject_Create();
CkJsonObject_LoadSb(jsonResponse,sbResponseBody);
id := CkJsonObject__stringOf(jsonResponse,'id');
object := CkJsonObject__stringOf(jsonResponse,'object');
created_at := CkJsonObject__stringOf(jsonResponse,'created_at');
updated_at := CkJsonObject__stringOf(jsonResponse,'updated_at');
mode := CkJsonObject__stringOf(jsonResponse,'mode');
status := CkJsonObject__stringOf(jsonResponse,'status');
reference := CkJsonObject__stringOf(jsonResponse,'reference');
min_datetime := CkJsonObject__stringOf(jsonResponse,'min_datetime');
max_datetime := CkJsonObject__stringOf(jsonResponse,'max_datetime');
is_account_address := CkJsonObject_BoolOf(jsonResponse,'is_account_address');
instructions := CkJsonObject__stringOf(jsonResponse,'instructions');
confirmation := CkJsonObject_IsNullOf(jsonResponse,'confirmation');
addressId := CkJsonObject__stringOf(jsonResponse,'address.id');
addressObject := CkJsonObject__stringOf(jsonResponse,'address.object');
addressCreated_at := CkJsonObject__stringOf(jsonResponse,'address.created_at');
addressUpdated_at := CkJsonObject__stringOf(jsonResponse,'address.updated_at');
addressName := CkJsonObject__stringOf(jsonResponse,'address.name');
addressCompany := CkJsonObject__stringOf(jsonResponse,'address.company');
addressStreet1 := CkJsonObject__stringOf(jsonResponse,'address.street1');
addressStreet2 := CkJsonObject__stringOf(jsonResponse,'address.street2');
addressCity := CkJsonObject__stringOf(jsonResponse,'address.city');
addressState := CkJsonObject__stringOf(jsonResponse,'address.state');
addressZip := CkJsonObject__stringOf(jsonResponse,'address.zip');
addressCountry := CkJsonObject__stringOf(jsonResponse,'address.country');
addressPhone := CkJsonObject__stringOf(jsonResponse,'address.phone');
addressEmail := CkJsonObject_IsNullOf(jsonResponse,'address.email');
addressMode := CkJsonObject__stringOf(jsonResponse,'address.mode');
addressCarrier_facility := CkJsonObject_IsNullOf(jsonResponse,'address.carrier_facility');
addressResidential := CkJsonObject_IsNullOf(jsonResponse,'address.residential');
addressFederal_tax_id := CkJsonObject_IsNullOf(jsonResponse,'address.federal_tax_id');
addressState_tax_id := CkJsonObject_IsNullOf(jsonResponse,'address.state_tax_id');
i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResponse,'messages');
while i < count_i do
begin
CkJsonObject_putI(jsonResponse,i);
i := i + 1;
end;
i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResponse,'carrier_accounts');
while i < count_i do
begin
CkJsonObject_putI(jsonResponse,i);
i := i + 1;
end;
i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResponse,'pickup_rates');
while i < count_i do
begin
CkJsonObject_putI(jsonResponse,i);
created_at := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].created_at');
currency := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].currency');
mode := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].mode');
rate := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].rate');
service := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].service');
updated_at := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].updated_at');
carrier := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].carrier');
pickup_id := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].pickup_id');
id := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].id');
object := CkJsonObject__stringOf(jsonResponse,'pickup_rates[i].object');
i := i + 1;
end;
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jsonResponse);
{
"id": "pickup_ebae2c59mdk83jsh39ma3a056ab3d1f1",
"object": "Pickup",
"created_at": "2015-03-17T20:03:07Z",
"updated_at": "2015-03-17T20:03:07Z",
"mode": "test",
"status": "unknown",
"reference": "my-first-pickup",
"min_datetime": "2015-03-18T08:00:00Z",
"max_datetime": "2015-03-18T18:00:00Z",
"is_account_address": false,
"instructions": "My special instructions",
"messages": [
],
"confirmation": null,
"address": {
"id": "adr_72N1gd6k",
"object": "Address",
"created_at": "2015-03-17T20:03:06Z",
"updated_at": "2015-03-17T20:03:06Z",
"name": "John Smith",
"company": "",
"street1": "123 Main St",
"street2": "",
"city": "Park City",
"state": "UT",
"zip": "84060",
"country": "US",
"phone": "5551231234",
"email": null,
"mode": "test",
"carrier_facility": null,
"residential": null,
"federal_tax_id": null,
"state_tax_id": null
},
"carrier_accounts": [
],
"pickup_rates": [
{
"created_at": "2015-03-17T20:03:07Z",
"currency": "USD",
"mode": "test",
"rate": "5.96",
"service": "Future-day Pickup",
"updated_at": "2015-03-17T20:03:07Z",
"carrier": "UPS",
"pickup_id": "pickup_ebae2c59mdk83jsh39ma3a056ab3d1f1",
"id": "pickuprate_092af6ac0opkhsfg72hj23eab18964bf2",
"object": "PickupRate"
}
]
}