Skip to content

Commit cfe97fe

Browse files
authored
Merge pull request #28 from 1415003719/2025-07
support 2025-07 version
2 parents 4eae447 + 52188f8 commit cfe97fe

File tree

162 files changed

+5577
-5516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+5577
-5516
lines changed

README.md

Lines changed: 96 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ If you need support using AfterShip products, please contact [email protected]
2727
- [Help](#help)
2828
- [License](#license)
2929

30-
3130
## Before you begin
3231

3332
Before you begin to integrate:
@@ -40,20 +39,21 @@ Before you begin to integrate:
4039

4140
Each SDK version is designed to work with a specific API version. Please refer to the table below to identify the supported API versions for each SDK version, ensuring you select the appropriate SDK version for the API version you intend to use.
4241

43-
| SDK Version | Supported API Version | Branch |
44-
| --- | --- | --- |
45-
| 13.x.x | 2025-04 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2025-04 |
46-
| 12.x.x | 2025-01 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2025-01 |
47-
| 11.x.x | 2024-10 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2024-10 |
48-
| 10.x.x | 2024-07 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2024-07 |
49-
| 9.x.x | 2024-04 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2024-04 |
50-
| 8.x.x | 2023-10 | https://github.com/AfterShip/aftership-sdk-nodejs |
51-
| <=7.x.x | Legacy API | https://github.com/AfterShip/aftership-sdk-nodejs |
52-
42+
| SDK Version | Supported API Version | Branch |
43+
| ----------- | --------------------- | ------------------------------------------------------------- |
44+
| 14.x.x | 2025-07 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2025-07 |
45+
| 13.x.x | 2025-04 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2025-04 |
46+
| 12.x.x | 2025-01 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2025-01 |
47+
| 11.x.x | 2024-10 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2024-10 |
48+
| 10.x.x | 2024-07 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2024-07 |
49+
| 9.x.x | 2024-04 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2024-04 |
50+
| 8.x.x | 2023-10 | https://github.com/AfterShip/aftership-sdk-nodejs |
51+
| <=7.x.x | Legacy API | https://github.com/AfterShip/aftership-sdk-nodejs |
5352

5453
## Quick Start
5554

5655
### Installation
56+
5757
```bash
5858
npm install --save @aftership/tracking-sdk
5959
```
@@ -64,7 +64,7 @@ Create AfterShip instance with options
6464

6565
| Name | Type | Required | Description |
6666
| ---------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
67-
| api_key | string | | Your AfterShip API key |
67+
| api_key | string || Your AfterShip API key |
6868
| auth_type | enum | | Default value: `AuthType.API_KEY` <br > AES authentication: `AuthType.AES` <br > RSA authentication: `AuthType.RSA` |
6969
| api_secret | string | | Required if the authentication type is `AuthType.AES` or `AuthType.RSA` |
7070
| domain | string | | AfterShip API domain. Default value: https://api.aftership.com |
@@ -77,44 +77,43 @@ Create AfterShip instance with options
7777

7878
```javascript
7979
// Step 1: Require the AfterShip client
80-
import {AfterShip} from '@aftership/tracking-sdk';
80+
import { AfterShip } from "@aftership/tracking-sdk";
8181
// or
8282
// const {AfterShip} = require('@aftership/tracking-sdk');
8383

84-
8584
// Step 2: Initialize the client object
86-
const aftership = new AfterShip({api_key: 'YOUR_API_KEY'});
85+
const aftership = new AfterShip({ api_key: "YOUR_API_KEY" });
8786

8887
// Step 3: Create the request object
8988
const createTrackingRequestBody = {
90-
tracking_number: '<tracking_number>',
91-
slug: '<slug>'
89+
tracking_number: "<tracking_number>",
90+
slug: "<slug>",
9291
};
9392

9493
// Step 4: Make the request
95-
aftership.tracking.createTracking(createTrackingRequestBody)
96-
.then(tracking => console.log(tracking))
97-
.catch(error => console.log(error));
94+
aftership.tracking
95+
.createTracking(createTrackingRequestBody)
96+
.then((tracking) => console.log(tracking))
97+
.catch((error) => console.log(error));
9898
```
9999

100100
## Rate Limiter
101101

102-
See the [Rate Limit](https://www.aftership.com/docs/tracking/2025-04/quickstart/rate-limit) to understand the AfterShip rate limit policy.
102+
See the [Rate Limit](https://www.aftership.com/docs/tracking/2025-07/quickstart/rate-limit) to understand the AfterShip rate limit policy.
103103

104104
## Error Handling
105105

106106
The SDK will return an error object when there is any error during the request, with the following specification:
107107

108-
| Name | Type | Description |
109-
| --------------- | ------ | ------------------------------ |
110-
| message | string | Detail message of the error |
111-
| code | enum | Error code enum for API Error. |
112-
| meta_code | number | API response meta code. |
113-
| status_code | number | HTTP status code. |
114-
| response_body | string | API response body. |
108+
| Name | Type | Description |
109+
| ---------------- | ------ | ------------------------------ |
110+
| message | string | Detail message of the error |
111+
| code | enum | Error code enum for API Error. |
112+
| meta_code | number | API response meta code. |
113+
| status_code | number | HTTP status code. |
114+
| response_body | string | API response body. |
115115
| response_headers | object | API response header. |
116116

117-
118117
### Error List
119118

120119
| code | meta_code | status_code | message |
@@ -150,7 +149,7 @@ The AfterShip instance has the following properties which are exactly the same a
150149
- tracking - Create trackings, update trackings, and get tracking results.
151150
- courier-connection - Create courier connections, update courier connections, and get courier connections results.
152151
- estimated-delivery-date - Get estimated delivery date for your order.
153-
152+
154153
### /trackings
155154

156155
**POST** /trackings
@@ -169,128 +168,135 @@ const payload = {
169168
};
170169

171170
aftership.tracking
172-
.createTracking(payload)
173-
.then((result) => console.log(result))
174-
.catch((e) => console.log(e));
171+
.createTracking(payload)
172+
.then((result) => console.log(result))
173+
.catch((e) => console.log(e));
175174
```
176175

177176
**DELETE** /trackings/:id
178177

179178
```javascript
180179
aftership.tracking
181-
.deleteTrackingById('<tracking_id>')
182-
.then((result) => console.log(result))
183-
.catch((e) => console.log(e));
180+
.deleteTrackingById("<tracking_id>")
181+
.then((result) => console.log(result))
182+
.catch((e) => console.log(e));
184183
```
185184

186185
**GET** /trackings
187186

188187
```javascript
189188
aftership.tracking
190-
.getTrackings({ limit: 10, fields: 'slug,tracking_number' })
191-
.then((result) => console.log(result))
192-
.catch((e) => console.log(e));
189+
.getTrackings({ limit: 10, fields: "slug,tracking_number" })
190+
.then((result) => console.log(result))
191+
.catch((e) => console.log(e));
193192
```
194193

195194
**GET** /trackings/:id
196195

197196
```javascript
198197
aftership.tracking
199-
.getTrackingById('<tracking_id>')
200-
.then((result) => console.log(result))
201-
.catch((e) => console.log(e));
198+
.getTrackingById("<tracking_id>")
199+
.then((result) => console.log(result))
200+
.catch((e) => console.log(e));
202201
```
203202

204203
**PUT** /trackings/:id
205204

206205
```javascript
207206
aftership.tracking
208-
.updateTrackingById('<tracking_id>',{title: 'New Title123'})
209-
.then((result) => console.log(result))
210-
.catch((e) => console.log(e));
207+
.updateTrackingById("<tracking_id>", { title: "New Title123" })
208+
.then((result) => console.log(result))
209+
.catch((e) => console.log(e));
211210
```
212211

213212
**POST** /trackings/:id/retrack
214213

215214
```javascript
216215
aftership.tracking
217-
.retrackTrackingById('<tracking_id>')
218-
.then((result) => console.log(result))
219-
.catch((e) => console.log(e));
216+
.retrackTrackingById("<tracking_id>")
217+
.then((result) => console.log(result))
218+
.catch((e) => console.log(e));
220219
```
221220

222221
**POST** /trackings/:id/mark-as-completed
223222

224223
```javascript
225224
aftership.tracking
226-
.markTrackingCompletedById('<tracking_id>', { reason: 'DELIVERED' })
227-
.then((result) => console.log(result))
228-
.catch((e) => console.log(e));
225+
.markTrackingCompletedById("<tracking_id>", { reason: "DELIVERED" })
226+
.then((result) => console.log(result))
227+
.catch((e) => console.log(e));
229228
```
230229

231230
### /couriers
231+
232232
**GET** /couriers
233233

234234
```javascript
235235
aftership.courier
236-
.GetCouriers()
237-
.then(result => console.log(result))
238-
.catch(e => console.log(e));
236+
.GetCouriers()
237+
.then((result) => console.log(result))
238+
.catch((e) => console.log(e));
239239
```
240240

241241
**POST** /couriers/detect
242242

243243
```js
244244
aftership.courier
245-
.detectCourier({ tracking_number: '<tracking_number>' })
246-
.then(result => console.log(result))
247-
.catch(e => console.log(e));
245+
.detectCourier({ tracking_number: "<tracking_number>" })
246+
.then((result) => console.log(result))
247+
.catch((e) => console.log(e));
248248
```
249249

250250
### /courier-connections
251+
251252
**GET** /courier-connections
252253

253254
```javascript
254255
aftership.courier
255-
.getCourierConnections()
256-
.then(result => console.log(result))
257-
.catch(e => console.log(e));
256+
.getCourierConnections()
257+
.then((result) => console.log(result))
258+
.catch((e) => console.log(e));
258259
```
259260

260261
**POST** /courier-connections
261262

262263
```js
263264
aftership.courier
264-
.postCourierConnections({courier_slug: "dhl-api", credentials: {"api_key": "<api_key>"}})
265-
.then(result => console.log(result))
266-
.catch(e => console.log(e));
265+
.postCourierConnections({
266+
courier_slug: "dhl-api",
267+
credentials: { api_key: "<api_key>" },
268+
})
269+
.then((result) => console.log(result))
270+
.catch((e) => console.log(e));
267271
```
268272

269273
**GET** /courier-connections/:id
270274

271275
```js
272276
aftership.courier
273-
.getCourierConnectionsById("<courier_connection_id>")
274-
.then(result => console.log(result))
275-
.catch(e => console.log(e));
277+
.getCourierConnectionsById("<courier_connection_id>")
278+
.then((result) => console.log(result))
279+
.catch((e) => console.log(e));
276280
```
277281

278282
**PATCH** /courier-connections/:id
279283

280284
```js
281285
aftership.courier
282-
.putCourierConnectionsById("<courier_connection_id>", {credentials: {"api_key": "<api_key>"}})
283-
.then(result => console.log(result))
284-
.catch(e => console.log(e));
286+
.putCourierConnectionsById("<courier_connection_id>", {
287+
credentials: { api_key: "<api_key>" },
288+
})
289+
.then((result) => console.log(result))
290+
.catch((e) => console.log(e));
285291
```
286292

287293
**DELETE** /courier-connections/:id
288294

289295
```js
290296
aftership.courier
291-
.deleteCourierConnectionsById("<courier_connection_id>")
292-
.then(result => console.log(result))
293-
.catch(e => console.log(e));
297+
.deleteCourierConnectionsById("<courier_connection_id>")
298+
.then((result) => console.log(result))
299+
.catch((e) => console.log(e));
294300
```
295301

296302
### /estimated-delivery-date
@@ -299,33 +305,34 @@ aftership.courier
299305

300306
```javascript
301307
const payload = {
302-
estimated_delivery_dates: [{
303-
slug: '<slug>',
304-
origin_address: { country: '<country>' },
305-
destination_address: { country: '<country>' },
306-
}]
308+
estimated_delivery_dates: [
309+
{
310+
slug: "<slug>",
311+
origin_address: { country: "<country>" },
312+
destination_address: { country: "<country>" },
313+
},
314+
],
307315
};
308316
aftership.estimatedDeliveryDate
309-
.predictBatch(payload)
310-
.then(result => console.log(result))
311-
.catch(e => console.log(e));
317+
.predictBatch(payload)
318+
.then((result) => console.log(result))
319+
.catch((e) => console.log(e));
312320
```
313321

314322
**POST** /estimated-delivery-date/predict
315323

316324
```javascript
317325
const payload = {
318-
slug: '<slug>',
319-
origin_address: { country: '<country>' },
320-
destination_address: { country: '<country>' },
326+
slug: "<slug>",
327+
origin_address: { country: "<country>" },
328+
destination_address: { country: "<country>" },
321329
};
322330
aftership.estimatedDeliveryDate
323-
.predict(payload)
324-
.then(result => console.log(result))
325-
.catch(e => console.log(e));
331+
.predict(payload)
332+
.then((result) => console.log(result))
333+
.catch((e) => console.log(e));
326334
```
327335

328-
329336
## Help
330337

331338
If you get stuck, we're here to help:
@@ -334,6 +341,7 @@ If you get stuck, we're here to help:
334341
- Contact AfterShip official support via [email protected]
335342

336343
## License
344+
337345
Copyright (c) 2025 AfterShip
338346

339-
Licensed under the MIT license.
347+
Licensed under the MIT license.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aftership/tracking-sdk",
3-
"version": "13.0.0",
3+
"version": "14.0.0",
44
"description": "Tracking NodeJS SDK",
55
"main": "dist/aftership.js",
66
"types": "dist/aftership.d.ts",
@@ -26,7 +26,8 @@
2626
"axios": "^1.7.2"
2727
},
2828
"keywords": [
29-
"aftership", "tracking"
29+
"aftership",
30+
"tracking"
3031
],
3132
"devDependencies": {
3233
"@types/node": "^20.11.25",

0 commit comments

Comments
 (0)