Skip to content

Commit 8d56e8d

Browse files
authored
validate addresses docs (#25)
1 parent 2ceca3f commit 8d56e8d

5 files changed

Lines changed: 143 additions & 793 deletions

File tree

docs/addressValidateExample.md

Lines changed: 0 additions & 173 deletions
This file was deleted.

docs/addressesValidateExample.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
Validate Addresses
2+
================================
3+
[ShipEngine](www.shipengine.com) allows you to validate an array of addresses before using it to create a shipment to ensure
4+
accurate delivery of your packages. Please see [our docs](https://www.shipengine.com/docs/addresses/validation/) to learn more about validating addresses.
5+
6+
Input Parameters
7+
------------------------------------
8+
The `validateAddresses` method accepts an array of addresses as seen in the documentation above.
9+
10+
Output
11+
--------------------------------
12+
The `validateAddresses` method returns an array of address validation result objects.
13+
14+
Example
15+
```php
16+
use ShipEngine\ShipEngine;
17+
use ShipEngine\Message\ShipEngineException;
18+
19+
function validateAddressesDemoFunction() {
20+
$client = new ShipEngine('API-Key');
21+
22+
$address = [
23+
[
24+
"name" => "John Smith",
25+
"company_name" => "ShipStation",
26+
"address_line1" => "3800 N Lamar Blvd",
27+
"address_line2" => "#220",
28+
"postal_code" => '78756',
29+
"country_code" => "US",
30+
"address_residential_indicator" => 'no',
31+
], [
32+
"name" => "John Smith",
33+
"company" => "ShipMate",
34+
"city_locality" => "Toronto",
35+
"state_province" => "On",
36+
"postal_code" => "M6K 3C3",
37+
"country_code" => "CA",
38+
"address_line1" => "123 Foo",
39+
]
40+
];
41+
42+
try {
43+
print_r($client->validateAddresses($address));
44+
} catch (ShipEngineException $e) {
45+
print_r($e -> getMessage());
46+
}
47+
}
48+
49+
validateAddressesDemoFunction();
50+
51+
```
52+
53+
Example Output
54+
-----------------------------------------------------
55+
56+
### Array of connected carrier accounts
57+
```php
58+
Array
59+
(
60+
[0] => Array
61+
(
62+
[status] => verified
63+
[original_address] => Array
64+
(
65+
[name] => John Smith
66+
[phone] =>
67+
[company_name] => ShipStation
68+
[address_line1] => 3800 N Lamar Blvd
69+
[address_line2] => #220
70+
[address_line3] =>
71+
[city_locality] =>
72+
[state_province] =>
73+
[postal_code] => 78756
74+
[country_code] => US
75+
[address_residential_indicator] => no
76+
)
77+
78+
[matched_address] => Array
79+
(
80+
[name] => JOHN SMITH
81+
[phone] =>
82+
[company_name] => SHIPSTATION
83+
[address_line1] => 3800 N LAMAR BLVD STE 220
84+
[address_line2] =>
85+
[address_line3] =>
86+
[city_locality] => AUSTIN
87+
[state_province] => TX
88+
[postal_code] => 78756-0003
89+
[country_code] => US
90+
[address_residential_indicator] => no
91+
)
92+
93+
[messages] => Array
94+
(
95+
)
96+
97+
)
98+
99+
[1] => Array
100+
(
101+
[status] => error
102+
[original_address] => Array
103+
(
104+
[name] => John Smith
105+
[phone] =>
106+
[company_name] =>
107+
[address_line1] => 123 Foo
108+
[address_line2] =>
109+
[address_line3] =>
110+
[city_locality] => Toronto
111+
[state_province] => On
112+
[postal_code] => M6K 3C3
113+
[country_code] => CA
114+
[address_residential_indicator] => unknown
115+
)
116+
117+
[matched_address] =>
118+
[messages] => Array
119+
(
120+
[0] => Array
121+
(
122+
[code] => a1002
123+
[message] => Could not match the inputted street name to a unique street name. No matches or too many matches were found.
124+
[type] => error
125+
[detail_code] => street_does_not_match_unique_street_name
126+
)
127+
128+
[1] => Array
129+
(
130+
[code] => a1004
131+
[message] => This address has been partially verified down to the city level. This is NOT the highest level possible with the data provided.
132+
[type] => error
133+
[detail_code] => partially_verified_to_city_level
134+
)
135+
136+
)
137+
138+
)
139+
140+
)
141+
```

docs/listCarriersExample.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Example
1212
use ShipEngine\ShipEngine;
1313
use ShipEngine\Message\ShipEngineException;
1414

15-
function list_carriers_demo_function() {
15+
function listCarriersDemoFunction() {
1616
$client = new ShipEngine('API-Key');
1717
try {
1818
print_r(json_encode($client->listCarriers(), JSON_PRETTY_PRINT));
@@ -21,7 +21,7 @@ function list_carriers_demo_function() {
2121
}
2222
}
2323

24-
list_carriers_demo_function();
24+
listCarriersDemoFunction();
2525
```
2626

2727
Example Output

0 commit comments

Comments
 (0)