(addresses())
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.
- list - List all addresses
- create - Create a new address
- get - Retrieve an address
- validate - Validate an address
Returns a list of all address objects that have been created in this account.
package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.ListAddressesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("<YOUR_API_KEY_HERE>")
.shippoApiVersion("2018-02-08")
.build();
ListAddressesResponse res = sdk.addresses().list()
.page(1L)
.results(5L)
.shippoApiVersion("2018-02-08")
.call();
if (res.addressPaginatedList().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
page |
Optional<Long> |
➖ |
The page number you want to select |
|
results |
Optional<Long> |
➖ |
The number of results to return per page (max 100, default 5) |
|
shippoApiVersion |
Optional<String> |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
ListAddressesResponse
Error Type |
Status Code |
Content Type |
models/errors/SDKError |
4XX, 5XX |
*/* |
Creates a new address object. You can use address objects to create new shipments, calculate rates, and to create orders.
package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.AddressCreateRequest;
import com.goshippo.shippo_sdk.models.operations.CreateAddressResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("<YOUR_API_KEY_HERE>")
.shippoApiVersion("2018-02-08")
.build();
CreateAddressResponse res = sdk.addresses().create()
.shippoApiVersion("2018-02-08")
.addressCreateRequest(AddressCreateRequest.builder()
.country("US")
.name("Shwan Ippotle")
.company("Shippo")
.street1("215 Clayton St.")
.street3("")
.streetNo("")
.city("San Francisco")
.state("CA")
.zip("94117")
.phone("+1 555 341 9393")
.email("[email protected]")
.isResidential(true)
.metadata("Customer ID 123456")
.validate(true)
.build())
.call();
if (res.address().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
shippoApiVersion |
Optional<String> |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
addressCreateRequest |
AddressCreateRequest |
✔️ |
Address details. |
|
CreateAddressResponse
Error Type |
Status Code |
Content Type |
models/errors/SDKError |
4XX, 5XX |
*/* |
Returns an existing address using an object ID.
package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.GetAddressResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("<YOUR_API_KEY_HERE>")
.shippoApiVersion("2018-02-08")
.build();
GetAddressResponse res = sdk.addresses().get()
.addressId("<id>")
.shippoApiVersion("2018-02-08")
.call();
if (res.address().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
addressId |
String |
✔️ |
Object ID of the address |
|
shippoApiVersion |
Optional<String> |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
GetAddressResponse
Error Type |
Status Code |
Content Type |
models/errors/SDKError |
4XX, 5XX |
*/* |
Validates an existing address using an object ID
package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.ValidateAddressResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("<YOUR_API_KEY_HERE>")
.shippoApiVersion("2018-02-08")
.build();
ValidateAddressResponse res = sdk.addresses().validate()
.addressId("<id>")
.shippoApiVersion("2018-02-08")
.call();
if (res.address().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
addressId |
String |
✔️ |
Object ID of the address |
|
shippoApiVersion |
Optional<String> |
➖ |
Optional string used to pick a non-default API version to use. See our API version guide. |
2018-02-08 |
ValidateAddressResponse
Error Type |
Status Code |
Content Type |
models/errors/SDKError |
4XX, 5XX |
*/* |