Webwrite in json format not working

12 ビュー (過去 30 日間)
Shantaram Jadhav
Shantaram Jadhav 2019 年 7 月 10 日
コメント済み: Guillaume 2019 年 7 月 24 日
I was trying to write to an server using REST API. I tried it using POSTMAN it was working. The data i am trying to write is in json format. I gave Content type as json and Mediatype as application/json. requestmethod as post. The erro message is "The srver returned the status 415 with message unsupported media type".
  4 件のコメント
Shantaram Jadhav
Shantaram Jadhav 2019 年 7 月 24 日
Hi,
As you have asked the code is as follows
Obj=weboptions
Obj.Username='DEMO';
Obj.Password='DEMO';
Obj.ContentType='json';
Obj.MediaType='application/json';
Obj.ArrayFormat='json';
Mea=struct('Name','Result','mimetype','','name','LinearFit','dataType','Array','unit','NA','mimeType','','dataValues',Regression_Results.Fitted);
webwrite('Link',Mea,Obj);
Note :
Regression_Results.Fitted is a vector of data type double.
I am not allowed to share the link where i am posting the data so it is given as link
Guillaume
Guillaume 2019 年 7 月 24 日
Can you also show the working json that you sent via postman?
Is it correct that you have both a mimetype and a mimeType property and both a Name and name property in your JSON? It's unusual to have properties that differ just by case (and horrendous design!)

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeJSON Format についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by