I think you will find this documentation helpful: https://www.mathworks.com/help/matlab/ref/webread.html
API call from postman to Matlab.
7 次查看(过去 30 天)
显示 更早的评论
I want to make an API call. I converted the script to a python code but can not make it to convert it to an matlab example.
I tried to use this link without any succes: https://nl.mathworks.com/help/thingspeak/readdata.html
Can Anyone help me how to request this API with the header?
HTTP:
GET /rfms2/vehiclestatuses?vin=YS2R6X20005376392&dateType=received&startTime=2022-01-12T00:00:00&stopTime=2022-01-12T23:59:59 HTTP/1.1
Host: dataaccess.scania.com
Accept: application/vnd.fmsstandard.com.VehicleStatuses.v2.1+json; UTF-8
Authorization: Bearer ****
Content-Type: application/json
Content-Length: 27
{"query":"","variables":{}}
Python:
import requests
import json
url = "https://dataaccess.scania.com/rfms2/vehiclestatuses?vin=YS2R6X20005376392&dateType=received&startTime=2022-01-12T00:00:00&stopTime=2022-01-12T23:59:59"
payload="{\"query\":\"\",\"variables\":{}}"
headers = {
'Accept': 'application/vnd.fmsstandard.com.VehicleStatuses.v2.1+json; UTF-8',
'Authorization': 'Bearer ****',
'Content-Type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Thanks
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call MATLAB from Python 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!