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개)
Vinod
2022년 1월 19일
I think you will find this documentation helpful: https://www.mathworks.com/help/matlab/ref/webread.html
댓글 수: 0
참고 항목
카테고리
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!