Skip to content

Latest commit

 

History

History
195 lines (139 loc) · 18 KB

README.md

File metadata and controls

195 lines (139 loc) · 18 KB

Addresses

(Addresses)

Overview

Addresses are the locations a parcel is being shipped from and to. They represent company and residential places. Among other things, you can use address objects to create shipments, calculate shipping rates, and purchase shipping labels.

Available Operations

  • List - List all addresses
  • Create - Create a new address
  • Get - Retrieve an address
  • Validate - Validate an address

List

Returns a list of all address objects that have been created in this account.

Example Usage

using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;

var sdk = new ShippoSDK(
    apiKeyHeader: "<YOUR_API_KEY_HERE>",
    shippoApiVersion: "2018-02-08"
);

var res = await sdk.Addresses.ListAsync(
    page: 1,
    results: 5,
    shippoApiVersion: "2018-02-08"
);

// handle response

Parameters

Parameter Type Required Description Example
Page long The page number you want to select
Results long The number of results to return per page (max 100, default 5)
ShippoApiVersion string Optional string used to pick a non-default API version to use. See our API version guide. 2018-02-08

Response

AddressPaginatedList

Errors

Error Type Status Code Content Type
Shippo.Models.Errors.SDKException 4XX, 5XX */*

Create

Creates a new address object. You can use address objects to create new shipments, calculate rates, and to create orders.

Example Usage

using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;

var sdk = new ShippoSDK(
    apiKeyHeader: "<YOUR_API_KEY_HERE>",
    shippoApiVersion: "2018-02-08"
);

var res = await sdk.Addresses.CreateAsync(
    addressCreateRequest: new AddressCreateRequest() {
        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 = "[email protected]",
        IsResidential = true,
        Metadata = "Customer ID 123456",
        Validate = true,
    },
    shippoApiVersion: "2018-02-08"
);

// handle response

Parameters

Parameter Type Required Description Example
AddressCreateRequest AddressCreateRequest ✔️ Address details.
ShippoApiVersion string Optional string used to pick a non-default API version to use. See our API version guide. 2018-02-08

Response

Address

Errors

Error Type Status Code Content Type
Shippo.Models.Errors.SDKException 4XX, 5XX */*

Get

Returns an existing address using an object ID.

Example Usage

using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;

var sdk = new ShippoSDK(
    apiKeyHeader: "<YOUR_API_KEY_HERE>",
    shippoApiVersion: "2018-02-08"
);

var res = await sdk.Addresses.GetAsync(
    addressId: "<id>",
    shippoApiVersion: "2018-02-08"
);

// handle response

Parameters

Parameter Type Required Description Example
AddressId string ✔️ Object ID of the address
ShippoApiVersion string Optional string used to pick a non-default API version to use. See our API version guide. 2018-02-08

Response

Address

Errors

Error Type Status Code Content Type
Shippo.Models.Errors.SDKException 4XX, 5XX */*

Validate

Validates an existing address using an object ID

Example Usage

using Shippo;
using Shippo.Models.Requests;
using Shippo.Models.Components;

var sdk = new ShippoSDK(
    apiKeyHeader: "<YOUR_API_KEY_HERE>",
    shippoApiVersion: "2018-02-08"
);

var res = await sdk.Addresses.ValidateAsync(
    addressId: "<id>",
    shippoApiVersion: "2018-02-08"
);

// handle response

Parameters

Parameter Type Required Description Example
AddressId string ✔️ Object ID of the address
ShippoApiVersion string Optional string used to pick a non-default API version to use. See our API version guide. 2018-02-08

Response

Address

Errors

Error Type Status Code Content Type
Shippo.Models.Errors.SDKException 4XX, 5XX */*