Created
October 19, 2011 18:18
-
-
Save danlynn/1299178 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var artNums = [ | |
"DV138501174HK", | |
"02002788399970580927", | |
"02002788399970580926", | |
"EG945761960US", | |
"92410944973202000000246909", | |
"9566700003681143083527", | |
"CA005338152RU", | |
"CA677001201US", | |
"EA272521142US", | |
"EA272521159US", | |
"EA272521166US", | |
"EA112233445US", | |
"EA272521173US", | |
"EC704344028US", | |
"EC704816592US", | |
"EC681952345US", | |
"EC972085813US", | |
"EC521473868US", | |
"01197154268000000301", | |
"01150134711929114011", | |
"93041764001000000081900009", | |
"01150134711929073950", | |
"9205590106729400000483", | |
"9502800007491266000012", | |
"93734699300000000000000140", | |
"92734944973202000000246906", | |
"70101670000234174276", | |
"9473303812003812000002", | |
"RB504224197US", | |
"9409801845001008450000", | |
"93088699300000000000000144", | |
"93089699300000000000000141", | |
"93098699300000000000000143", | |
"70101870000287813571", | |
"93041764001000000081900009", | |
"9402101845001008450008", | |
"93043764001000000081900003", | |
"9404311764001008190000", | |
"08150134711929140624", | |
"08150134711929114892", | |
"08150134711929111815", | |
"03103200000097539707", | |
"08150134711929133442", | |
"8200009344", | |
"8200007815", | |
"8200036994", | |
"8200040553", | |
"8200077196", | |
"26150134711929117387", | |
"22900007541120353688", | |
"22150134711929083358", | |
"22150134711929084515", | |
"08150134711929115905", | |
"CJ025151514US", | |
"CJ025151942US", | |
"CJ025151085US", | |
"CJ025208823US", | |
"CP100289449US", | |
"LK100000003TH", | |
"LC723925255AU" | |
]; | |
for (var i = 0; i < artNums.length; ++i) { | |
var artNum = artNums[i]; | |
var foundHoldForPickup = false; | |
var protocol = "https:"; | |
var host = "ecom-sit-int.usps.com"; | |
var path = "/TrackFieldsWeb/TrackingFieldsServlet"; | |
var pts_req = "{\"articleObject\":{\"article-num\":\""+artNum+"\"}}"; | |
var jqxhr = $.getJSON(protocol+"//" + host + path, {"Track":pts_req}, function(data) { | |
if (data.trackingResponse.error != null) | |
console.log(data.trackingResponse); | |
else { | |
console.log(data.trackingResponse.tracking[0]['article-num']+": Success"); | |
var tracking = data.trackingResponse.tracking[0]; | |
var idx = 1; | |
while (tracking['service'+idx] != undefined) { | |
if (tracking['service'+idx].match(/HFPU|HFP|Hold For Pickup/)) { | |
console.log("Found 'Hold For Pickup' service on article "+artNum); | |
foundHoldForPickup = true; | |
break; | |
} | |
idx += 1; | |
} | |
} | |
}); | |
} | |
console.log("done") | |
// 8200007815: Success | |
// 8200009344: Success | |
// 02002788399970580927: Success | |
// 02002788399970580926: Success | |
// CA005338152RU: Success | |
// CA677001201US: Success |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment