never worked before with curl APIs so idk. I need to convert curl to html because I cant use at DIO service. Can someone help me please? thank you
I changed to http url for safety.
curl -X 'GET' \
'https://assignment-api.blocked.com.tr/api/v1/product/all' \
-H 'accept: application/json' \
-H 'access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InN1bGV5bWFudXJlbjA3QGdtYWlsLmNvbSIsImlhdCI6MTY1NDY1NTIzNSwiZXhwIjoxNjgwNTc1MjM1fQ.L3t4E-x-IWlT1wjRx3WNzp-ecX-MsntIl-tRiD9zZmg'
CodePudding user response:
Try this:
Future<Map<String, dynamic>> getRequest() async {
var url = 'https://assignment-api.blocked.com.tr/api/v1/product/all';
var response = await http.get(
url,
headers: {
'accept': 'application/json',
'access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InN1bGV5bWFudXJlbjA3QGdtYWlsLmNvbSIsImlhdCI6MTY1NDY1NTIzNSwiZXhwIjoxNjgwNTc1MjM1fQ.L3t4E-x-IWlT1wjRx3WNzp-ecX-MsntIl-tRiD9zZmg'
'Content-Type': 'application/json-patch json',
},
);
return json.decode(response.body);
}
CodePudding user response:
it worked thank you soo much ^^