这是我的卷发:
curl -X POST "http://bc.itg.ro:1239/api/ro/products" -H "accept: application/json" -H "X-Accept-Token: 7b030f02cce38a84d35122b5f353faq1" -H "Content-Type: application/json" -d "{ \"language_id\": 2, \"currency_id\": 4, \"filters\": { \"category_ids\": [ 56 ] }, \"current_page\": 1, \"limit\": 20}"
我想调用api以获取JSON
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
// Check if request is completed
if (xhr.readyState == XMLHttpRequest.DONE) {
// Do what needs to be done here
console.log(xhr.response);
}
}
// Set the request URL and request method
xhr.open("POST", "http://bc.itg.ro:1239/api/ro/products");
// Set the `Content-Type` Request header
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("X-Accept-Token", "7b030f02cce38a84d35122b5f353faq1");
xhr.setRequestHeader("Content-Type", "application/json");
// Send the requst with Data
xhr.send('{\"language_id\": 2, \"currency_id\": 4, \"filters\": { \"category_ids\": [ 56 ] }, \"current_page\": 1, \"limit\": 20}');
}
1条答案
按热度按时间qzlgjiam1#
试试看: