我必須為 api 發出 http 請求
基本網址是:https : //learning-objects-v2.p.rapidapi.com
GET /search-provider?keywords=Python&lang=en&provider=Coursera&sort=popularity&model=strict&max=20&page=2
X-Rapidapi-Host: learning-objects-v2.p.rapidapi.com
X-Rapidapi-Key: key
Host: learning-objects-v2.p.rapidapi.com
我試過的
var client = http.Client();
var result = null;
final response = await client.get(
Uri.parse(
'https://learning-objects-v2.p.rapidapi.com/search-provider?keywords=$keyword&lang=en&provider=Coursera&sort=popularity&model=strict&max=20&page=2'),
// Send authorization headers to the backend.
headers: {
HttpHeaders.acceptHeader:
'key',
},
);
但這似乎不能正常作業有人可以幫助我嗎
uj5u.com熱心網友回復:
嘗試
Map<String, String> requestHeaders = {
'Content-type': 'application/json',
'Accept': 'application/json',
'Authorization': '<Your token>'
};
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/345326.html
