Created
September 25, 2019 08:51
-
-
Save PamornT/9baefd8bff502db58e3d07c983475347 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
let params = { | |
"status": "all", | |
"language": "TH", | |
"barcode": [ | |
code | |
] | |
}; | |
let promise_track = new Promise(resolve => { | |
var options = { | |
method: 'POST', | |
uri: 'https://trackwebhook.thailandpost.co.th/post/api/v1/hook', | |
strictSSL: false, | |
body: JSON.stringify(params), | |
headers: { | |
'Content-Type': 'application/json', | |
'Authorization': 'Token ' + access_token.token | |
} | |
}; | |
request(options, function(error, response, body) { | |
resolve( JSON.parse(body) ); | |
}); | |
}); | |
let track = await promise_track; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment