Skip to content

Instantly share code, notes, and snippets.

@PamornT
Created September 25, 2019 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PamornT/9baefd8bff502db58e3d07c983475347 to your computer and use it in GitHub Desktop.
Save PamornT/9baefd8bff502db58e3d07c983475347 to your computer and use it in GitHub Desktop.
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