Last active
February 1, 2020 01:54
-
-
Save madiodio/4170f73199d594eb1c351b084ca5b636 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const apiUrl = "http://api.paps.sn/api/v1/" | |
const apiKey = "7090e4f41fd0dd4750b1bab1b0fa563e222aee17272" | |
const methodName = "createTasksWithClientApp" | |
const params = { | |
email: "[email protected]", | |
deliveries: [ | |
{ | |
address: "Almadies, Dakar, Senegal", | |
name: "Saliou Samb", | |
time: "2020-01-25 19:31:00", | |
phone: "+221702002020", | |
job_description: "Test Saliou" | |
}, | |
{ | |
address: "Medina, Dakar, Senegal", | |
name: "Nogaye Kébé", | |
time: "2020-01-25 19:31:00", | |
phone: "+221702002020", | |
job_description: "Test Nogaye", | |
email: "[email protected]" | |
} | |
] | |
} | |
const isTest = "test=true" | |
const response = await fetch(`${apiUrl}/${methodName}?&${isTest}`, headers: { 'Content-Type': 'application/json' }, { body: params }); | |
const myJson = await response.json() | |
console.log(myJson); | |
/* | |
{ | |
"message": "Successful", | |
"status": 200, | |
"data": { | |
"deliveries": [ | |
{ | |
"job_id": 70048654, | |
"job_hash": "90b56488cf1ef6fbd03d73d9d2644cb6", | |
"job_token": "7004865415801530743604544", | |
"status": true, | |
"auto_assignment_data": 0, | |
"order_id": 65577, | |
"result_tracking_link": "https://jngl.ml/3dWS9d264", | |
}, | |
{ | |
"job_id": 70048656, | |
"job_hash": "90b56488cf1ef6fbd03d73d9d2644cb6", | |
"job_token": "7004865415801530743604544", | |
"status": true, | |
"auto_assignment_data": 0, | |
"order_id": 65577, | |
"result_tracking_link": "https://jngl.ml/3dWS9d264", | |
} | |
] | |
} | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment