I can not authorize my API call

2 views (last 30 days)
Dion Theunissen
Dion Theunissen on 17 Aug 2022
Commented: Geoff Hayes on 31 Aug 2022
I try to create a PUT API call but I am not able to authorize my call.
username = 'APIDionSimi';
password = '****';
s.id = "e37b35dd-4aca-4ecb-8972-55c3a27a8b11";
data = jsonencode(s,PrettyPrint=true)
% data = jsondecode(s,Prettyprint=true);
body = matlab.net.http.MessageBody(data);
% authorizationField = matlab.net.http.field.AuthorizationField("APIDionSimi","NOgp!3808")
contentTypeField = matlab.net.http.field.ContentTypeField('application/json');
% autho = matlab.net.http.Credentials("Username","APIDionSimi","Password","NOgp!3808")
header = [contentTypeField]
method = matlab.net.http.RequestMethod.PUT;
uri = "https://apps.reeleezee.nl/api/v1/4a2dfa57-ff9a-400b-9c3a-b6a3beafd597/salesinvoices/fa19e531-ca5f-4682-b62a-f95d80175440"
request = matlab.net.http.RequestMessage(method,header,body);
show(request)
resp = send(request,uri)
I tried several options without succes. Anyone who can help?
  1 Comment
Geoff Hayes
Geoff Hayes on 31 Aug 2022
@Dion Theunissen - are you observing errors? Can you show the expected API format that you need to follow?

Sign in to comment.

Answers (0)

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!