0

I'm trying to implement the DHL API for Tracking Package. Everything is working fine, i receive the data form DHL server, but, i can not undestand how should use the MessageTime and MessageReference Value in the request, what should i put in each of the parameters or how i can do it. Thank you

<ServiceHeader>
<MessageTime>2019-09-23T15:54:10</MessageTime>                  
<MessageReference>xxxx</MessageReference>
</ServiceHeader>

1 Answers1

0

It would be well commented in the API documentation.

I personally use the following in the shipment API, the comments would have been gleaned from the supplied documentation.

This is from my personal code and is not the tracking API, but I guess it will be similar and consistent:

// Mandatory - The MessageTime element contains the time at which the message was sent by the requestor. The format of
// the element should be YYYY-MM-DD(T)hh-mm-ss - Time Zone where “T” is the separator between date
// and time
request.ServiceHeader.MessageTime = DateTime.Now;

// Mandatory - The MessageReference element should contain a unique reference to the message, so that trace of
// a particular message can easily be carried out. It must be a minimum length of 28 and maximum
// 32.The value can be decided by the customer.
request.ServiceHeader.MessageReference = Guid.NewGuid().ToString("N");

Edit

I double checked with the tracking API and it's the same:

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
TheGeneral
  • 79,002
  • 9
  • 103
  • 141