Home > Blockchain >  USPS Package Track API is not returning XML child elements for TrackSummary
USPS Package Track API is not returning XML child elements for TrackSummary

Time:12-27

Please see the temporary solution at the end.

Summary (added 12/24/22 for clarification):

USPS's tracking API is not returning responses in the same format as their documentation. The actual format makes it difficult to extract the event date since there is no EventDate XML element. Worst case, I can use regex, but was wondering if there was a way to receive API responses as showing in USPS's documentation.

Details

In USPS's enter image description here

enter image description here Matched item with groups - it use in code.

enter image description here

Time parsing

(\d{2}|\d{1})\:(\d{2})\s*(am|pm)

enter image description here

enter image description here

Matched item with groups - it use in code.

enter image description here

References

Find string between two substrings

Converting Strings Using datetime

Regexper

regular expression 101

  • Related