MATLAB http post and json request
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur JSON Format dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!