diff --git a/pom.xml b/pom.xml index f60c20f..dc927e4 100644 --- a/pom.xml +++ b/pom.xml @@ -1,88 +1,88 @@ - - 4.0.0 - - io.ljunggren - dhl-api - 0.0.1-SNAPSHOT - jar - - dhl-tracker - http://maven.apache.org - - - UTF-8 - 1.8 - 1.8 - - - - - org.apache.httpcomponents - httpclient - 4.5.8 - - - com.fasterxml.jackson.core - jackson-databind - 2.9.9 - - - io.ljunggren - json-utils - 0.0.1-SNAPSHOT - - - commons-io - commons-io - 2.8.0 - - - org.projectlombok - lombok - 1.18.22 - provided - - - junit - junit - 4.13.2 - test - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - - - - - - nexus - http://nexus.ljunggren.io/repository/maven-releases/ - - - nexus - http://nexus.ljunggren.io/repository/maven-snapshots/ - - - - - https://gitbucket.ljunggren.io/git/aljunggren/dhl-api.git - scm:git:https://gitbucket.ljunggren.io/git/aljunggren/dhl-api.git - scm:git:https://gitbucket.ljunggren.io/git/aljunggren/dhl-api.git - HEAD - - - + + 4.0.0 + + io.ljunggren + dhl-api + 0.0.1-SNAPSHOT + jar + + dhl-tracker + http://maven.apache.org + + + UTF-8 + 1.8 + 1.8 + + + + + org.apache.httpcomponents + httpclient + 4.5.8 + + + com.fasterxml.jackson.core + jackson-databind + 2.9.9 + + + io.ljunggren + json-utils + 0.0.1-SNAPSHOT + + + commons-io + commons-io + 2.8.0 + + + org.projectlombok + lombok + 1.18.38 + provided + + + junit + junit + 4.13.2 + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + + nexus + http://nexus.ljunggren.io/repository/maven-releases/ + + + nexus + http://nexus.ljunggren.io/repository/maven-snapshots/ + + + + + https://gitbucket.ljunggren.io/git/aljunggren/dhl-api.git + scm:git:https://gitbucket.ljunggren.io/git/aljunggren/dhl-api.git + scm:git:https://gitbucket.ljunggren.io/git/aljunggren/dhl-api.git + HEAD + + + diff --git a/src/main/java/io/ljunggren/dhl/api/service/BaseService.java b/src/main/java/io/ljunggren/dhl/api/service/BaseService.java index ace647a..3e2922f 100644 --- a/src/main/java/io/ljunggren/dhl/api/service/BaseService.java +++ b/src/main/java/io/ljunggren/dhl/api/service/BaseService.java @@ -1,52 +1,52 @@ -package io.ljunggren.dhl.api.service; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; - -import org.apache.http.HttpResponse; -import org.apache.http.client.config.CookieSpecs; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; - -import com.fasterxml.jackson.core.JsonProcessingException; - -import io.ljunggren.json.utils.JsonUtils; - -public class BaseService { - - protected String domain; - protected String apiKey; - - protected BaseService(String domain, String apiKey) { - this.domain = domain; - this.apiKey = apiKey; - } - - protected CloseableHttpClient getHttpClient() { - return HttpClients.custom() - .setDefaultRequestConfig(RequestConfig.custom() - .setCookieSpec(CookieSpecs.STANDARD).build()) - .build(); - } - - protected static String getResult(HttpResponse response) throws UnsupportedOperationException, IOException { - BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), StandardCharsets.UTF_8)); - StringBuilder result = new StringBuilder(); - String line = new String(); - while ((line = rd.readLine()) != null) { - result.append(line); - } - return result.toString(); - } - - protected T parse(String json, Class clazz) throws Exception { - try { - return JsonUtils.jsonToObject(json, clazz); - } catch (JsonProcessingException e) { - throw new Exception("Unable to parse response"); - } - } -} +package io.ljunggren.dhl.api.service; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; + +import org.apache.http.HttpResponse; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; + +import com.fasterxml.jackson.core.JsonProcessingException; + +import io.ljunggren.json.utils.JsonUtils; + +public class BaseService { + + protected String domain; + protected String apiKey; + + protected BaseService(String domain, String apiKey) { + this.domain = domain; + this.apiKey = apiKey; + } + + protected CloseableHttpClient getHttpClient() { + return HttpClients.custom() + .setDefaultRequestConfig(RequestConfig.custom() + .setCookieSpec(CookieSpecs.STANDARD).build()) + .build(); + } + + protected static String getResult(HttpResponse response) throws UnsupportedOperationException, IOException { + BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), StandardCharsets.UTF_8)); + StringBuilder result = new StringBuilder(); + String line = new String(); + while ((line = rd.readLine()) != null) { + result.append(line); + } + return result.toString(); + } + + protected T parse(String json, Class clazz) throws Exception { + try { + return JsonUtils.jsonToObject(json, clazz); + } catch (JsonProcessingException e) { + throw new Exception("Unable to parse response"); + } + } +} diff --git a/src/main/java/io/ljunggren/dhl/api/service/TrackingService.java b/src/main/java/io/ljunggren/dhl/api/service/TrackingService.java index 2a37c72..f847199 100644 --- a/src/main/java/io/ljunggren/dhl/api/service/TrackingService.java +++ b/src/main/java/io/ljunggren/dhl/api/service/TrackingService.java @@ -1,95 +1,95 @@ -package io.ljunggren.dhl.api.service; - -import java.io.IOException; -import java.net.URI; - -import org.apache.http.Header; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.message.BasicHeader; - -import io.ljunggren.dhl.api.model.tracking.response.Error; -import io.ljunggren.dhl.api.model.tracking.response.TrackingResponse; - -public class TrackingService extends BaseService { - - public TrackingService(String domain, String apiKey) { - super(domain, apiKey); - } - - private final String URI = domain + "/track/shipments"; - - public TrackingResponse track(String trackingNumber) throws IOException { - return track(getHttpClient(), new String[] {trackingNumber}, true); - } - - public TrackingResponse track(String[] trackingNumbers) throws IOException { - return track(getHttpClient(), trackingNumbers, true); - } - - private TrackingResponse track(CloseableHttpClient httpClient, String[] trackingNumbers, boolean retry) throws IOException { - Header[] headers = generateHeaders(); - try { - URI uri = new URIBuilder(URI).addParameter("trackingNumber", String.join(",", trackingNumbers)).build(); - HttpGet get = new HttpGet(uri); - get.setHeaders(headers); - CloseableHttpResponse response = httpClient.execute(get); - int responseCode = response.getStatusLine().getStatusCode(); - String json = getResult(response); - if (200 == responseCode) { - Thread.sleep(5000); - return parse(json, TrackingResponse.class); - } - Error error = parseError(json); - if (error == null) { - return unkownResponse(responseCode, json); - } - switch (error.getStatus()) { - case 429: - case 500: - if (retry) { - Thread.sleep(5000); - return track(httpClient, trackingNumbers, false); - } - return errorResponse(error); - default: return errorResponse(error); - } - } catch(Exception e) { - e.printStackTrace(); - } finally { - httpClient.close(); - } - return null; - } - - private Header[] generateHeaders() { - return new Header[] { - new BasicHeader("content-type", "application/json"), - new BasicHeader("DHL-API-Key", apiKey) - }; - } - - private Error parseError(String json) { - try { - return parse(json, Error.class); - } catch (Exception e) { - return null; - } - } - - private TrackingResponse unkownResponse(int responseCode, String message) { - Error error = new Error(null, responseCode, message); - TrackingResponse trackingResponse = new TrackingResponse(); - trackingResponse.setError(error); - return trackingResponse; - } - - private TrackingResponse errorResponse(Error error) throws Exception { - TrackingResponse trackingResponse = new TrackingResponse(); - trackingResponse.setError(error); - return trackingResponse; - } - -} +package io.ljunggren.dhl.api.service; + +import java.io.IOException; +import java.net.URI; + +import org.apache.http.Header; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.message.BasicHeader; + +import io.ljunggren.dhl.api.model.tracking.response.Error; +import io.ljunggren.dhl.api.model.tracking.response.TrackingResponse; + +public class TrackingService extends BaseService { + + public TrackingService(String domain, String apiKey) { + super(domain, apiKey); + } + + private final String URI = domain + "/track/shipments"; + + public TrackingResponse track(String trackingNumber) throws IOException { + return track(getHttpClient(), new String[] {trackingNumber}, true); + } + + public TrackingResponse track(String[] trackingNumbers) throws IOException { + return track(getHttpClient(), trackingNumbers, true); + } + + private TrackingResponse track(CloseableHttpClient httpClient, String[] trackingNumbers, boolean retry) throws IOException { + Header[] headers = generateHeaders(); + try { + URI uri = new URIBuilder(URI).addParameter("trackingNumber", String.join(",", trackingNumbers)).build(); + HttpGet get = new HttpGet(uri); + get.setHeaders(headers); + CloseableHttpResponse response = httpClient.execute(get); + int responseCode = response.getStatusLine().getStatusCode(); + String json = getResult(response); + if (200 == responseCode) { + Thread.sleep(5000); + return parse(json, TrackingResponse.class); + } + Error error = parseError(json); + if (error == null) { + return unkownResponse(responseCode, json); + } + switch (error.getStatus()) { + case 429: + case 500: + if (retry) { + Thread.sleep(5000); + return track(httpClient, trackingNumbers, false); + } + return errorResponse(error); + default: return errorResponse(error); + } + } catch(Exception e) { + e.printStackTrace(); + } finally { + httpClient.close(); + } + return null; + } + + private Header[] generateHeaders() { + return new Header[] { + new BasicHeader("content-type", "application/json"), + new BasicHeader("DHL-API-Key", apiKey) + }; + } + + private Error parseError(String json) { + try { + return parse(json, Error.class); + } catch (Exception e) { + return null; + } + } + + private TrackingResponse unkownResponse(int responseCode, String message) { + Error error = new Error(null, responseCode, message); + TrackingResponse trackingResponse = new TrackingResponse(); + trackingResponse.setError(error); + return trackingResponse; + } + + private TrackingResponse errorResponse(Error error) throws Exception { + TrackingResponse trackingResponse = new TrackingResponse(); + trackingResponse.setError(error); + return trackingResponse; + } + +} diff --git a/src/test/java/io/ljunggren/dhl/api/response/TrackingResponseTest.java b/src/test/java/io/ljunggren/dhl/api/response/TrackingResponseTest.java index 15ca9ec..cfb84b1 100644 --- a/src/test/java/io/ljunggren/dhl/api/response/TrackingResponseTest.java +++ b/src/test/java/io/ljunggren/dhl/api/response/TrackingResponseTest.java @@ -1,26 +1,26 @@ -package io.ljunggren.dhl.api.response; - -import static org.junit.Assert.assertNotNull; - -import java.io.IOException; - -import org.apache.commons.io.IOUtils; -import org.junit.Test; - -import io.ljunggren.dhl.api.model.tracking.response.TrackingResponse; -import io.ljunggren.json.utils.JsonUtils; - -public class TrackingResponseTest { - - private String readFromResources(String file) throws IOException { - return IOUtils.toString(this.getClass().getResourceAsStream(file), "UTF-8"); - } - - @Test - public void serializeTrackingResponseTest() throws IOException { - String json = readFromResources("/trackingResponse.json"); - TrackingResponse response = JsonUtils.jsonToObject(json, TrackingResponse.class); - assertNotNull(response); - } - -} +package io.ljunggren.dhl.api.response; + +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + +import org.apache.commons.io.IOUtils; +import org.junit.Test; + +import io.ljunggren.dhl.api.model.tracking.response.TrackingResponse; +import io.ljunggren.json.utils.JsonUtils; + +public class TrackingResponseTest { + + private String readFromResources(String file) throws IOException { + return IOUtils.toString(this.getClass().getResourceAsStream(file), "UTF-8"); + } + + @Test + public void serializeTrackingResponseTest() throws IOException { + String json = readFromResources("/trackingResponse.json"); + TrackingResponse response = JsonUtils.jsonToObject(json, TrackingResponse.class); + assertNotNull(response); + } + +} diff --git a/src/test/resources/trackingResponse.json b/src/test/resources/trackingResponse.json index 88b3962..06f5ca7 100644 --- a/src/test/resources/trackingResponse.json +++ b/src/test/resources/trackingResponse.json @@ -1,255 +1,255 @@ -{ - "shipments" : [ { - "id" : "4214131471", - "service" : "express", - "origin" : { - "address" : { - "addressLocality" : "LONG BEACH - California - USA" - }, - "servicePoint" : { - "url" : "http://www.dhl-usa.com/en/country_profile.html", - "label" : "Origin Service Area" - } - }, - "destination" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA" - }, - "servicePoint" : { - "url" : "http://www.dhl.com.au/en/country_profile.html", - "label" : "Destination Service Area" - } - }, - "status" : { - "timestamp" : "2024-10-11T10:23:00+11:00", - "location" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "102", - "description" : "Arrived at DHL Delivery Facility MELBOURNE - AUSTRALIA" - }, - "estimatedTimeOfDelivery" : "2024-10-15", - "estimatedTimeOfDeliveryRemark" : "By End of Day", - "returnFlag" : false, - "details" : { - "product" : { - "productCode" : "P", - "productName" : "EXPRESS WORLDWIDE" - }, - "shipper" : { - "@type" : "Organization", - "address" : { - "countryCode" : "US" - } - }, - "consignee" : { - "@type" : "Organization", - "address" : { - "countryCode" : "AU" - } - }, - "proofOfDelivery" : { - "documentUrl" : "https://proview.dhl.com/proview/adhocnotify?id=v%2BWImNb8JPHqWWZMSwW55gc%2FyZbd05fG27S7Lr3fQEo%3D&appuid=sn9Vur1lJfG59Ww7H1XnrQ%3D%3D&locale=en&token=nrjE5Zpqt99ohEu%2FUi7JkbA0V4qA124LF2O22zX5298%3D", - "signatureUrl" : "https://proview.dhl.com/proview/adhocnotify?id=v%2BWImNb8JPHqWWZMSwW55gc%2FyZbd05fG27S7Lr3fQEo%3D&appuid=sn9Vur1lJfG59Ww7H1XnrQ%3D%3D&locale=en&token=nrjE5Zpqt99ohEu%2FUi7JkbA0V4qA124LF2O22zX5298%3D" - }, - "proofOfDeliverySignedAvailable" : false, - "totalNumberOfPieces" : 1, - "pieceIds" : [ "JD014600011781044024" ], - "controlledDataCodes" : [ "shipper-city", "consignee-city" ], - "shipmentActivationDate" : "2024-10-08T19:59:00" - }, - "events" : [ { - "timestamp" : "2024-10-11T10:23:00+11:00", - "location" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "AR", - "description" : "Arrived at DHL Delivery Facility MELBOURNE - AUSTRALIA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-11T09:46:00+11:00", - "location" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "DF", - "description" : "Shipment has departed from a DHL facility MELBOURNE - AUSTRALIA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-11T09:45:00+11:00", - "location" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "PL", - "description" : "Processed at MELBOURNE - AUSTRALIA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-11T07:26:00+11:00", - "location" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "CR", - "description" : "Clearance processing complete at MELBOURNE - AUSTRALIA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-11T05:46:00+11:00", - "location" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "AF", - "description" : "Arrived at DHL Sort Facility MELBOURNE - AUSTRALIA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-10T20:23:00+11:00", - "location" : { - "address" : { - "addressLocality" : "SYDNEY - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "TR", - "description" : "Shipment is in transit to destination", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-10T15:40:00+10:00", - "location" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "RR", - "description" : "Customs clearance status updated. Note - The Customs clearance process may start while the shipment is in transit to the destination. " - }, { - "timestamp" : "2024-10-10T13:27:00+10:00", - "location" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "RR", - "description" : "Customs clearance status updated. Note - The Customs clearance process may start while the shipment is in transit to the destination. " - }, { - "timestamp" : "2024-10-10T05:36:00+10:00", - "location" : { - "address" : { - "addressLocality" : "MELBOURNE - AUSTRALIA", - "countryCode" : "AU" - } - }, - "statusCode" : "transit", - "status" : "RR", - "description" : "Customs clearance status updated. Note - The Customs clearance process may start while the shipment is in transit to the destination. " - }, { - "timestamp" : "2024-10-09T12:13:00-10:00", - "location" : { - "address" : { - "addressLocality" : "HONOLULU - Hawaii - USA", - "countryCode" : "US" - } - }, - "statusCode" : "transit", - "status" : "DF", - "description" : "Shipment has departed from a DHL facility HONOLULU - USA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-09T08:34:00-10:00", - "location" : { - "address" : { - "addressLocality" : "HONOLULU - Hawaii - USA", - "countryCode" : "US" - } - }, - "statusCode" : "transit", - "status" : "TR", - "description" : "Shipment is in transit to destination", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-09T07:04:00-07:00", - "location" : { - "address" : { - "addressLocality" : "LOS ANGELES GATEWAY - California - USA", - "countryCode" : "US" - } - }, - "statusCode" : "transit", - "status" : "DF", - "description" : "Shipment has departed from a DHL facility LOS ANGELES GATEWAY - USA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-09T04:42:00-07:00", - "location" : { - "address" : { - "addressLocality" : "LOS ANGELES GATEWAY - California - USA", - "countryCode" : "US" - } - }, - "statusCode" : "transit", - "status" : "PL", - "description" : "Processed at LOS ANGELES GATEWAY - USA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-08T20:49:00-07:00", - "location" : { - "address" : { - "addressLocality" : "LONG BEACH - California - USA", - "countryCode" : "US" - } - }, - "statusCode" : "transit", - "status" : "DF", - "description" : "Shipment has departed from a DHL facility LONG BEACH - USA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-08T20:44:00-07:00", - "location" : { - "address" : { - "addressLocality" : "LONG BEACH - California - USA", - "countryCode" : "US" - } - }, - "statusCode" : "transit", - "status" : "PL", - "description" : "Processed at LONG BEACH - USA", - "pieceIds" : [ "JD014600011781044024" ] - }, { - "timestamp" : "2024-10-08T19:59:00-07:00", - "location" : { - "address" : { - "addressLocality" : "LONG BEACH - California - USA", - "countryCode" : "US" - } - }, - "statusCode" : "unknown", - "status" : "SD", - "description" : "Shipment information received" - } ] - } ] +{ + "shipments" : [ { + "id" : "4214131471", + "service" : "express", + "origin" : { + "address" : { + "addressLocality" : "LONG BEACH - California - USA" + }, + "servicePoint" : { + "url" : "http://www.dhl-usa.com/en/country_profile.html", + "label" : "Origin Service Area" + } + }, + "destination" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA" + }, + "servicePoint" : { + "url" : "http://www.dhl.com.au/en/country_profile.html", + "label" : "Destination Service Area" + } + }, + "status" : { + "timestamp" : "2024-10-11T10:23:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "102", + "description" : "Arrived at DHL Delivery Facility MELBOURNE - AUSTRALIA" + }, + "estimatedTimeOfDelivery" : "2024-10-15", + "estimatedTimeOfDeliveryRemark" : "By End of Day", + "returnFlag" : false, + "details" : { + "product" : { + "productCode" : "P", + "productName" : "EXPRESS WORLDWIDE" + }, + "shipper" : { + "@type" : "Organization", + "address" : { + "countryCode" : "US" + } + }, + "consignee" : { + "@type" : "Organization", + "address" : { + "countryCode" : "AU" + } + }, + "proofOfDelivery" : { + "documentUrl" : "https://proview.dhl.com/proview/adhocnotify?id=v%2BWImNb8JPHqWWZMSwW55gc%2FyZbd05fG27S7Lr3fQEo%3D&appuid=sn9Vur1lJfG59Ww7H1XnrQ%3D%3D&locale=en&token=nrjE5Zpqt99ohEu%2FUi7JkbA0V4qA124LF2O22zX5298%3D", + "signatureUrl" : "https://proview.dhl.com/proview/adhocnotify?id=v%2BWImNb8JPHqWWZMSwW55gc%2FyZbd05fG27S7Lr3fQEo%3D&appuid=sn9Vur1lJfG59Ww7H1XnrQ%3D%3D&locale=en&token=nrjE5Zpqt99ohEu%2FUi7JkbA0V4qA124LF2O22zX5298%3D" + }, + "proofOfDeliverySignedAvailable" : false, + "totalNumberOfPieces" : 1, + "pieceIds" : [ "JD014600011781044024" ], + "controlledDataCodes" : [ "shipper-city", "consignee-city" ], + "shipmentActivationDate" : "2024-10-08T19:59:00" + }, + "events" : [ { + "timestamp" : "2024-10-11T10:23:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "AR", + "description" : "Arrived at DHL Delivery Facility MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-11T09:46:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "DF", + "description" : "Shipment has departed from a DHL facility MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-11T09:45:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "PL", + "description" : "Processed at MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-11T07:26:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "CR", + "description" : "Clearance processing complete at MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-11T05:46:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "AF", + "description" : "Arrived at DHL Sort Facility MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-10T20:23:00+11:00", + "location" : { + "address" : { + "addressLocality" : "SYDNEY - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "TR", + "description" : "Shipment is in transit to destination", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-10T15:40:00+10:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "RR", + "description" : "Customs clearance status updated. Note - The Customs clearance process may start while the shipment is in transit to the destination. " + }, { + "timestamp" : "2024-10-10T13:27:00+10:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "RR", + "description" : "Customs clearance status updated. Note - The Customs clearance process may start while the shipment is in transit to the destination. " + }, { + "timestamp" : "2024-10-10T05:36:00+10:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "RR", + "description" : "Customs clearance status updated. Note - The Customs clearance process may start while the shipment is in transit to the destination. " + }, { + "timestamp" : "2024-10-09T12:13:00-10:00", + "location" : { + "address" : { + "addressLocality" : "HONOLULU - Hawaii - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "DF", + "description" : "Shipment has departed from a DHL facility HONOLULU - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-09T08:34:00-10:00", + "location" : { + "address" : { + "addressLocality" : "HONOLULU - Hawaii - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "TR", + "description" : "Shipment is in transit to destination", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-09T07:04:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LOS ANGELES GATEWAY - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "DF", + "description" : "Shipment has departed from a DHL facility LOS ANGELES GATEWAY - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-09T04:42:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LOS ANGELES GATEWAY - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "PL", + "description" : "Processed at LOS ANGELES GATEWAY - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-08T20:49:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LONG BEACH - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "DF", + "description" : "Shipment has departed from a DHL facility LONG BEACH - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-08T20:44:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LONG BEACH - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "PL", + "description" : "Processed at LONG BEACH - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-08T19:59:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LONG BEACH - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "unknown", + "status" : "SD", + "description" : "Shipment information received" + } ] + } ] } \ No newline at end of file