MATLAB http post and json request
古いコメントを表示
Hello
I need please some help to implement the below "Python" code in MATLAB.
I want to be able to perform a request to identify if a key exists and if it is valid through connecting to a certain website
%% Python code ================================
import requests
import json
data = requests.post(
"https://api.somewebsite/accounts/CC/licenses/actions/validate-key",
headers={
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json"
},
data=json.dumps({
"meta": {
"key": "xxxxxxxxxxxxxxxxxxx"
}
})
).json()
if data["meta"]["valid"]:
# Do something
else:
# Do something else
%% ================================
many thanks
Mohammad
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で JSON Format についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!