-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] Add
.http
files for API call references (#127)
- Loading branch information
Showing
27 changed files
with
1,471 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
These are `.http` files representing examples of HTTP requests that can be made to the API. | ||
|
||
They can be run using the [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) extension | ||
in Visual Studio Code or the [HTTP Client](https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html) | ||
in JetBrains IDEs. They can also be exported as cURL commands. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
@API_KEY = EASYPOST_API_KEY | ||
|
||
# Create an Address | ||
POST https://api.easypost.com/v2/addresses | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"address": { | ||
"street1": "417 MONTGOMERY ST", | ||
"street2": "FLOOR 5", | ||
"city": "SAN FRANCISCO", | ||
"state": "CA", | ||
"zip": "94104", | ||
"country": "US", | ||
"company": "EasyPost", | ||
"phone": "415-123-4567" | ||
} | ||
} | ||
|
||
### | ||
|
||
# Create and verify an Address in one call (basic verification checks) | ||
POST https://api.easypost.com/v2/addresses/create_and_verify | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"address": { | ||
"street1": "000 unknown street", | ||
"city": "Not A City", | ||
"state": "ZZ", | ||
"zip": "00001", | ||
"country": "US", | ||
"email": "[email protected]", | ||
"phone": "5555555555" | ||
} | ||
} | ||
|
||
### | ||
|
||
# Create and verify an Address in one call (basic + delivery/zip validation) | ||
POST https://api.easypost.com/v2/addresses/create | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"address": { | ||
"street1": "000 unknown street", | ||
"city": "Not A City", | ||
"state": "ZZ", | ||
"zip": "00001", | ||
"country": "US", | ||
"email": "[email protected]", | ||
"phone": "5555555555" | ||
}, | ||
"verify": true | ||
} | ||
|
||
### | ||
|
||
# Create and verify an Address in one call (basic + strict delivery/zip validation) | ||
POST https://api.easypost.com/v2/addresses/create | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"address": { | ||
"street1": "000 unknown street", | ||
"city": "Not A City", | ||
"state": "ZZ", | ||
"zip": "00001", | ||
"country": "US", | ||
"email": "[email protected]", | ||
"phone": "5555555555" | ||
}, | ||
"verify_strict": true | ||
} | ||
|
||
### | ||
|
||
# Verify an existing Address (basic verification checks) | ||
GET https://api.easypost.com/v2/addresses/{{ADDRESS_ID}}/verify | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Retrieve an Address | ||
GET https://api.easypost.com/v2/addresses/{{ADDRESS_ID}} | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# List all Addresses | ||
GET https://api.easypost.com/v2/addresses | ||
?page_size=10 | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@API_KEY = EASYPOST_API_KEY | ||
|
||
# Create a test API key | ||
POST https://api.easypost.com/v2/api_keys | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"mode": "test" | ||
} | ||
|
||
### | ||
|
||
# Create a production API key | ||
POST https://api.easypost.com/v2/api_keys | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"mode": "production" | ||
} | ||
|
||
### | ||
|
||
# Retrieve all API keys | ||
GET https://api.easypost.com/v2/api_keys | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Enable a disabled API key | ||
POST https://api.easypost.com/v2/api_keys/{{API_KEY_ID}}/enable | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Disable an enabled API key | ||
POST https://api.easypost.com/v2/api_keys/{{API_KEY_ID}}/disable | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Delete an API key | ||
DELETE https://api.easypost.com/v2/api_keys/{{API_KEY_ID}} | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
@API_KEY = EASYPOST_API_KEY | ||
|
||
# Create a Batch with existing Shipments | ||
POST https://api.easypost.com/v2/batches | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"batch": { | ||
"shipments": [ | ||
{ | ||
"id": "shp_123" | ||
}, | ||
{ | ||
"id": "shp_456" | ||
} | ||
] | ||
} | ||
} | ||
|
||
### | ||
|
||
# Add Shipments to a Batch | ||
POST https://api.easypost.com/v2/batches/{{BATCH_ID}}/add_shipments | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"shipments": [ | ||
{ | ||
"id": "shp_789" | ||
} | ||
] | ||
} | ||
|
||
### | ||
|
||
# Remove Shipments from a Batch | ||
POST https://api.easypost.com/v2/batches/{{BATCH_ID}}/remove_shipments | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"shipments": [ | ||
{ | ||
"id": "shp_789" | ||
} | ||
] | ||
} | ||
|
||
### | ||
|
||
# Purchase a Batch | ||
POST https://api.easypost.com/v2/batches/{{BATCH_ID}}/buy | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Generate a label for a Batch | ||
POST https://api.easypost.com/v2/batches/{{BATCH_ID}}/label | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"file_format": "PDF" | ||
} | ||
|
||
### | ||
|
||
# Generate a ScanForm for a Batch | ||
POST https://api.easypost.com/v2/batches/{{BATCH_ID}}/scan_form | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Retrieve a Batch | ||
GET https://api.easypost.com/v2/batches/{{BATCH_ID}} | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# List all Batches | ||
GET https://api.easypost.com/v2/batches | ||
?page_size=5 | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@PARTNER_API_KEY = PARTNER_API_KEY | ||
@REFERRAL_CUSTOMER_API_KEY = REFERRAL_CUSTOMER_API_KEY | ||
@API_KEY = EASYPOST_API_KEY | ||
|
||
# Get EasyPost public key for authenticating with Stripe | ||
GET https://api.easypost.com/v2/partners/stripe_public_key | ||
Authorization: Bearer {{PARTNER_API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Add a Stripe credit card to referral customer's account | ||
POST https://api.easypost.com/v2/credit_cards | ||
Authorization: Bearer {{REFERRAL_CUSTOMER_API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"credit_card": { | ||
"stripe_object_id": "tok_...", | ||
"priority": "primary" | ||
} | ||
} | ||
|
||
### | ||
|
||
# List account payment methods | ||
GET https://api.easypost.com/v2/payment_methods | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Fund account with on-file credit card ($10.00) | ||
POST https://api.easypost.com/v2/credit_cards/{{CREDIT_CARD_ID}}/charges | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"amount": 1000 | ||
} | ||
|
||
### | ||
|
||
# Fund account with on-file bank account ($10.00) | ||
POST https://api.easypost.com/v2/bank_accounts/{{BANK_ACCOUNT_ID}}/charges | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Delete an on-file credit card from account | ||
DELETE https://api.easypost.com/v2/credit_cards/{{CREDIT_CARD_ID}} | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
### | ||
|
||
# Delete an on-file bank account from account | ||
DELETE https://api.easypost.com/v2/bank_accounts/{{BANK_ACCOUNT_ID}} | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@API_KEY = EASYPOST_API_KEY | ||
|
||
# Update a user's brand | ||
PATCH https://api.easypost.com/v2/users/{{USER_ID}}/brand | ||
Authorization: Bearer {{API_KEY}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"brand": { | ||
"background_color": "#FFFFFF", | ||
"color": "#303F9F", | ||
"logo": "data:image/png;base64,iVBORw0K...", | ||
"logo_href": "https://easypost.com", | ||
"ad": "null", | ||
"ad_href": "null", | ||
"theme": "theme1" | ||
} | ||
} |
Oops, something went wrong.