Sending data to Firebase from Matlab





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I want to save data to firebase from Matlab. Does firebase have similar api calls like ThingSpeak? How can i send JSON data from matlab by making API calls?



I am making API calls from Matlab like for JSON:



    Firebase_Url = 'https://ecgproject-86945.firebaseio.com/';
writeApiKey = '***';
data = ['api_key=',writeApiKey,'&name=',"JSOpn9ZC54A4P4RoqVa"];
response = webwrite(Firebase_Url,data)

%data = struct('api_key',writeApiKey,'field1',data); //also tries this
%options = weboptions('MediaType','application/json');


The Error:



Error using readContentFromWebService (line 46)
The server returned the status 405 with message "Method Not Allowed" in response to the
request to URL https://ecgproject-86945.firebaseio.com/.

Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);

Error in Untitled (line 16)
response = webwrite(Firebase_Url,data)









share|improve this question

























  • I answered a very similar question yesterday: stackoverflow.com/questions/53467712/…

    – Frank van Puffelen
    Nov 26 '18 at 14:45











  • Yes but doesnt specify how to use the Rest service from Matlab.

    – Rashed Mazumder
    Nov 26 '18 at 14:56











  • I did a quick search on "performing HTTP calls from Matlab" and saw a lot of promising results. Did you try any of those yet? Where did you get stuck?

    – Frank van Puffelen
    Nov 26 '18 at 15:32











  • I used Thingspeak Previously. I follwed the tutorial as for webwrite() of matlab. But i guess firebase has different formatting for the data.Here is the link: mathworks.com/help/matlab/ref/webwrite.html . I have also updated my question with the code i am running on matlab now for firebase.

    – Rashed Mazumder
    Nov 26 '18 at 16:14













  • If you tried something, edit your question to include what you tried (which you just did I see). From the error message it looks like you're not passing a request body, which is required when performing a HTTP POST request. Did you try the "Write JSON Object" example from mathworks.com/help/matlab/ref/webwrite.html?

    – Frank van Puffelen
    Nov 26 '18 at 16:58




















0















I want to save data to firebase from Matlab. Does firebase have similar api calls like ThingSpeak? How can i send JSON data from matlab by making API calls?



I am making API calls from Matlab like for JSON:



    Firebase_Url = 'https://ecgproject-86945.firebaseio.com/';
writeApiKey = '***';
data = ['api_key=',writeApiKey,'&name=',"JSOpn9ZC54A4P4RoqVa"];
response = webwrite(Firebase_Url,data)

%data = struct('api_key',writeApiKey,'field1',data); //also tries this
%options = weboptions('MediaType','application/json');


The Error:



Error using readContentFromWebService (line 46)
The server returned the status 405 with message "Method Not Allowed" in response to the
request to URL https://ecgproject-86945.firebaseio.com/.

Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);

Error in Untitled (line 16)
response = webwrite(Firebase_Url,data)









share|improve this question

























  • I answered a very similar question yesterday: stackoverflow.com/questions/53467712/…

    – Frank van Puffelen
    Nov 26 '18 at 14:45











  • Yes but doesnt specify how to use the Rest service from Matlab.

    – Rashed Mazumder
    Nov 26 '18 at 14:56











  • I did a quick search on "performing HTTP calls from Matlab" and saw a lot of promising results. Did you try any of those yet? Where did you get stuck?

    – Frank van Puffelen
    Nov 26 '18 at 15:32











  • I used Thingspeak Previously. I follwed the tutorial as for webwrite() of matlab. But i guess firebase has different formatting for the data.Here is the link: mathworks.com/help/matlab/ref/webwrite.html . I have also updated my question with the code i am running on matlab now for firebase.

    – Rashed Mazumder
    Nov 26 '18 at 16:14













  • If you tried something, edit your question to include what you tried (which you just did I see). From the error message it looks like you're not passing a request body, which is required when performing a HTTP POST request. Did you try the "Write JSON Object" example from mathworks.com/help/matlab/ref/webwrite.html?

    – Frank van Puffelen
    Nov 26 '18 at 16:58
















0












0








0








I want to save data to firebase from Matlab. Does firebase have similar api calls like ThingSpeak? How can i send JSON data from matlab by making API calls?



I am making API calls from Matlab like for JSON:



    Firebase_Url = 'https://ecgproject-86945.firebaseio.com/';
writeApiKey = '***';
data = ['api_key=',writeApiKey,'&name=',"JSOpn9ZC54A4P4RoqVa"];
response = webwrite(Firebase_Url,data)

%data = struct('api_key',writeApiKey,'field1',data); //also tries this
%options = weboptions('MediaType','application/json');


The Error:



Error using readContentFromWebService (line 46)
The server returned the status 405 with message "Method Not Allowed" in response to the
request to URL https://ecgproject-86945.firebaseio.com/.

Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);

Error in Untitled (line 16)
response = webwrite(Firebase_Url,data)









share|improve this question
















I want to save data to firebase from Matlab. Does firebase have similar api calls like ThingSpeak? How can i send JSON data from matlab by making API calls?



I am making API calls from Matlab like for JSON:



    Firebase_Url = 'https://ecgproject-86945.firebaseio.com/';
writeApiKey = '***';
data = ['api_key=',writeApiKey,'&name=',"JSOpn9ZC54A4P4RoqVa"];
response = webwrite(Firebase_Url,data)

%data = struct('api_key',writeApiKey,'field1',data); //also tries this
%options = weboptions('MediaType','application/json');


The Error:



Error using readContentFromWebService (line 46)
The server returned the status 405 with message "Method Not Allowed" in response to the
request to URL https://ecgproject-86945.firebaseio.com/.

Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);

Error in Untitled (line 16)
response = webwrite(Firebase_Url,data)






matlab rest firebase






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 16:05







Rashed Mazumder

















asked Nov 26 '18 at 14:43









Rashed MazumderRashed Mazumder

115




115













  • I answered a very similar question yesterday: stackoverflow.com/questions/53467712/…

    – Frank van Puffelen
    Nov 26 '18 at 14:45











  • Yes but doesnt specify how to use the Rest service from Matlab.

    – Rashed Mazumder
    Nov 26 '18 at 14:56











  • I did a quick search on "performing HTTP calls from Matlab" and saw a lot of promising results. Did you try any of those yet? Where did you get stuck?

    – Frank van Puffelen
    Nov 26 '18 at 15:32











  • I used Thingspeak Previously. I follwed the tutorial as for webwrite() of matlab. But i guess firebase has different formatting for the data.Here is the link: mathworks.com/help/matlab/ref/webwrite.html . I have also updated my question with the code i am running on matlab now for firebase.

    – Rashed Mazumder
    Nov 26 '18 at 16:14













  • If you tried something, edit your question to include what you tried (which you just did I see). From the error message it looks like you're not passing a request body, which is required when performing a HTTP POST request. Did you try the "Write JSON Object" example from mathworks.com/help/matlab/ref/webwrite.html?

    – Frank van Puffelen
    Nov 26 '18 at 16:58





















  • I answered a very similar question yesterday: stackoverflow.com/questions/53467712/…

    – Frank van Puffelen
    Nov 26 '18 at 14:45











  • Yes but doesnt specify how to use the Rest service from Matlab.

    – Rashed Mazumder
    Nov 26 '18 at 14:56











  • I did a quick search on "performing HTTP calls from Matlab" and saw a lot of promising results. Did you try any of those yet? Where did you get stuck?

    – Frank van Puffelen
    Nov 26 '18 at 15:32











  • I used Thingspeak Previously. I follwed the tutorial as for webwrite() of matlab. But i guess firebase has different formatting for the data.Here is the link: mathworks.com/help/matlab/ref/webwrite.html . I have also updated my question with the code i am running on matlab now for firebase.

    – Rashed Mazumder
    Nov 26 '18 at 16:14













  • If you tried something, edit your question to include what you tried (which you just did I see). From the error message it looks like you're not passing a request body, which is required when performing a HTTP POST request. Did you try the "Write JSON Object" example from mathworks.com/help/matlab/ref/webwrite.html?

    – Frank van Puffelen
    Nov 26 '18 at 16:58



















I answered a very similar question yesterday: stackoverflow.com/questions/53467712/…

– Frank van Puffelen
Nov 26 '18 at 14:45





I answered a very similar question yesterday: stackoverflow.com/questions/53467712/…

– Frank van Puffelen
Nov 26 '18 at 14:45













Yes but doesnt specify how to use the Rest service from Matlab.

– Rashed Mazumder
Nov 26 '18 at 14:56





Yes but doesnt specify how to use the Rest service from Matlab.

– Rashed Mazumder
Nov 26 '18 at 14:56













I did a quick search on "performing HTTP calls from Matlab" and saw a lot of promising results. Did you try any of those yet? Where did you get stuck?

– Frank van Puffelen
Nov 26 '18 at 15:32





I did a quick search on "performing HTTP calls from Matlab" and saw a lot of promising results. Did you try any of those yet? Where did you get stuck?

– Frank van Puffelen
Nov 26 '18 at 15:32













I used Thingspeak Previously. I follwed the tutorial as for webwrite() of matlab. But i guess firebase has different formatting for the data.Here is the link: mathworks.com/help/matlab/ref/webwrite.html . I have also updated my question with the code i am running on matlab now for firebase.

– Rashed Mazumder
Nov 26 '18 at 16:14







I used Thingspeak Previously. I follwed the tutorial as for webwrite() of matlab. But i guess firebase has different formatting for the data.Here is the link: mathworks.com/help/matlab/ref/webwrite.html . I have also updated my question with the code i am running on matlab now for firebase.

– Rashed Mazumder
Nov 26 '18 at 16:14















If you tried something, edit your question to include what you tried (which you just did I see). From the error message it looks like you're not passing a request body, which is required when performing a HTTP POST request. Did you try the "Write JSON Object" example from mathworks.com/help/matlab/ref/webwrite.html?

– Frank van Puffelen
Nov 26 '18 at 16:58







If you tried something, edit your question to include what you tried (which you just did I see). From the error message it looks like you're not passing a request body, which is required when performing a HTTP POST request. Did you try the "Write JSON Object" example from mathworks.com/help/matlab/ref/webwrite.html?

– Frank van Puffelen
Nov 26 '18 at 16:58














2 Answers
2






active

oldest

votes


















0














From reading the mathworks documentation on webwrite you need to use the two-parameter version of the method, passing in the additional information inside the second, data object:



data = ['api_key=',writeApiKey,'&name=',"JSOpn9ZC54A4P4RoqVa"];

response = webwrite(FirebaseURL,data)





share|improve this answer
























  • This also doesn't work. I have edited my question also for this method. I think the firebase API has different formatting. Have you worked with firebase api from matlab? Thank You

    – Rashed Mazumder
    Nov 27 '18 at 16:06



















0














Okay I found the solution apparently i didn't add .json at the end of the URL. Thank You. Here is the solution:



Firebase_Url = 'https://***.firebaseio.com/Channel1.json';
response = webwrite(Firebase_Url,'{ "first": "Jack", "last": "Sparrow" }')





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53483531%2fsending-data-to-firebase-from-matlab%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    From reading the mathworks documentation on webwrite you need to use the two-parameter version of the method, passing in the additional information inside the second, data object:



    data = ['api_key=',writeApiKey,'&name=',"JSOpn9ZC54A4P4RoqVa"];

    response = webwrite(FirebaseURL,data)





    share|improve this answer
























    • This also doesn't work. I have edited my question also for this method. I think the firebase API has different formatting. Have you worked with firebase api from matlab? Thank You

      – Rashed Mazumder
      Nov 27 '18 at 16:06
















    0














    From reading the mathworks documentation on webwrite you need to use the two-parameter version of the method, passing in the additional information inside the second, data object:



    data = ['api_key=',writeApiKey,'&name=',"JSOpn9ZC54A4P4RoqVa"];

    response = webwrite(FirebaseURL,data)





    share|improve this answer
























    • This also doesn't work. I have edited my question also for this method. I think the firebase API has different formatting. Have you worked with firebase api from matlab? Thank You

      – Rashed Mazumder
      Nov 27 '18 at 16:06














    0












    0








    0







    From reading the mathworks documentation on webwrite you need to use the two-parameter version of the method, passing in the additional information inside the second, data object:



    data = ['api_key=',writeApiKey,'&name=',"JSOpn9ZC54A4P4RoqVa"];

    response = webwrite(FirebaseURL,data)





    share|improve this answer













    From reading the mathworks documentation on webwrite you need to use the two-parameter version of the method, passing in the additional information inside the second, data object:



    data = ['api_key=',writeApiKey,'&name=',"JSOpn9ZC54A4P4RoqVa"];

    response = webwrite(FirebaseURL,data)






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 26 '18 at 18:17









    Frank van PuffelenFrank van Puffelen

    245k30389417




    245k30389417













    • This also doesn't work. I have edited my question also for this method. I think the firebase API has different formatting. Have you worked with firebase api from matlab? Thank You

      – Rashed Mazumder
      Nov 27 '18 at 16:06



















    • This also doesn't work. I have edited my question also for this method. I think the firebase API has different formatting. Have you worked with firebase api from matlab? Thank You

      – Rashed Mazumder
      Nov 27 '18 at 16:06

















    This also doesn't work. I have edited my question also for this method. I think the firebase API has different formatting. Have you worked with firebase api from matlab? Thank You

    – Rashed Mazumder
    Nov 27 '18 at 16:06





    This also doesn't work. I have edited my question also for this method. I think the firebase API has different formatting. Have you worked with firebase api from matlab? Thank You

    – Rashed Mazumder
    Nov 27 '18 at 16:06













    0














    Okay I found the solution apparently i didn't add .json at the end of the URL. Thank You. Here is the solution:



    Firebase_Url = 'https://***.firebaseio.com/Channel1.json';
    response = webwrite(Firebase_Url,'{ "first": "Jack", "last": "Sparrow" }')





    share|improve this answer




























      0














      Okay I found the solution apparently i didn't add .json at the end of the URL. Thank You. Here is the solution:



      Firebase_Url = 'https://***.firebaseio.com/Channel1.json';
      response = webwrite(Firebase_Url,'{ "first": "Jack", "last": "Sparrow" }')





      share|improve this answer


























        0












        0








        0







        Okay I found the solution apparently i didn't add .json at the end of the URL. Thank You. Here is the solution:



        Firebase_Url = 'https://***.firebaseio.com/Channel1.json';
        response = webwrite(Firebase_Url,'{ "first": "Jack", "last": "Sparrow" }')





        share|improve this answer













        Okay I found the solution apparently i didn't add .json at the end of the URL. Thank You. Here is the solution:



        Firebase_Url = 'https://***.firebaseio.com/Channel1.json';
        response = webwrite(Firebase_Url,'{ "first": "Jack", "last": "Sparrow" }')






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 27 '18 at 16:18









        Rashed MazumderRashed Mazumder

        115




        115






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53483531%2fsending-data-to-firebase-from-matlab%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Tonle Sap (See)

            I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

            Guatemaltekische Davis-Cup-Mannschaft