GET request works on Chrome but not on Postman





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







0















I'm trying to get these itens called "cards" out of a MongoDB/AngularJS application. But only archived ones. Schema/structure bellow:



API route:



router.get('/showArchivedCard/:idParam', (req, res) => {
var body = req.body;
conn.getConnection(req, res, 'ListModel', function (ListModel) {
ListModel.find({status:'active', _id:req.params.idParam, 'cards.status':'archived', 'cards._id':body._id}, (err, data) => {
if (err) {
return res.status(500).json({ error: true, data: err });
}
return res.status(201).json({ error: false, data: data });
});
});});


API something (I don't know what this is called):



    let _getArchivedCard = (listId, cardId) => {

return $http({
method : 'GET',
url : EasyTask.API + '/api/v3/list/showArchivedCard/' + listId,
data: cardId,
headers : { 'Content-Type':'application/json', 'tokenName' :EasyTask.tokenName},
async : true
});
};


DB model/schema + Postman API call



Postman return (returns correctly what I want)



Chrome API call



Chrome API return



I'm sorry if this question feels too vague or convoluted, I don't know how to briefly and pragmatically explain such a complex scenario, also it's my first question here. If there's any information I've let out or anything I've missed please let me know.










share|improve this question





























    0















    I'm trying to get these itens called "cards" out of a MongoDB/AngularJS application. But only archived ones. Schema/structure bellow:



    API route:



    router.get('/showArchivedCard/:idParam', (req, res) => {
    var body = req.body;
    conn.getConnection(req, res, 'ListModel', function (ListModel) {
    ListModel.find({status:'active', _id:req.params.idParam, 'cards.status':'archived', 'cards._id':body._id}, (err, data) => {
    if (err) {
    return res.status(500).json({ error: true, data: err });
    }
    return res.status(201).json({ error: false, data: data });
    });
    });});


    API something (I don't know what this is called):



        let _getArchivedCard = (listId, cardId) => {

    return $http({
    method : 'GET',
    url : EasyTask.API + '/api/v3/list/showArchivedCard/' + listId,
    data: cardId,
    headers : { 'Content-Type':'application/json', 'tokenName' :EasyTask.tokenName},
    async : true
    });
    };


    DB model/schema + Postman API call



    Postman return (returns correctly what I want)



    Chrome API call



    Chrome API return



    I'm sorry if this question feels too vague or convoluted, I don't know how to briefly and pragmatically explain such a complex scenario, also it's my first question here. If there's any information I've let out or anything I've missed please let me know.










    share|improve this question

























      0












      0








      0








      I'm trying to get these itens called "cards" out of a MongoDB/AngularJS application. But only archived ones. Schema/structure bellow:



      API route:



      router.get('/showArchivedCard/:idParam', (req, res) => {
      var body = req.body;
      conn.getConnection(req, res, 'ListModel', function (ListModel) {
      ListModel.find({status:'active', _id:req.params.idParam, 'cards.status':'archived', 'cards._id':body._id}, (err, data) => {
      if (err) {
      return res.status(500).json({ error: true, data: err });
      }
      return res.status(201).json({ error: false, data: data });
      });
      });});


      API something (I don't know what this is called):



          let _getArchivedCard = (listId, cardId) => {

      return $http({
      method : 'GET',
      url : EasyTask.API + '/api/v3/list/showArchivedCard/' + listId,
      data: cardId,
      headers : { 'Content-Type':'application/json', 'tokenName' :EasyTask.tokenName},
      async : true
      });
      };


      DB model/schema + Postman API call



      Postman return (returns correctly what I want)



      Chrome API call



      Chrome API return



      I'm sorry if this question feels too vague or convoluted, I don't know how to briefly and pragmatically explain such a complex scenario, also it's my first question here. If there's any information I've let out or anything I've missed please let me know.










      share|improve this question














      I'm trying to get these itens called "cards" out of a MongoDB/AngularJS application. But only archived ones. Schema/structure bellow:



      API route:



      router.get('/showArchivedCard/:idParam', (req, res) => {
      var body = req.body;
      conn.getConnection(req, res, 'ListModel', function (ListModel) {
      ListModel.find({status:'active', _id:req.params.idParam, 'cards.status':'archived', 'cards._id':body._id}, (err, data) => {
      if (err) {
      return res.status(500).json({ error: true, data: err });
      }
      return res.status(201).json({ error: false, data: data });
      });
      });});


      API something (I don't know what this is called):



          let _getArchivedCard = (listId, cardId) => {

      return $http({
      method : 'GET',
      url : EasyTask.API + '/api/v3/list/showArchivedCard/' + listId,
      data: cardId,
      headers : { 'Content-Type':'application/json', 'tokenName' :EasyTask.tokenName},
      async : true
      });
      };


      DB model/schema + Postman API call



      Postman return (returns correctly what I want)



      Chrome API call



      Chrome API return



      I'm sorry if this question feels too vague or convoluted, I don't know how to briefly and pragmatically explain such a complex scenario, also it's my first question here. If there's any information I've let out or anything I've missed please let me know.







      mongodb api request postman






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 '18 at 16:09









      Gustavo MaximoGustavo Maximo

      11




      11
























          1 Answer
          1






          active

          oldest

          votes


















          0














          After putting a console.log(req.body) under the Router I found out that apparently the GET method doesn't allow a body, so I was basically sending an empty query. I don't know why it worked on Postman but all I had to do was change the method I use in the API to router.post instead of router.get.






          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%2f53341577%2fget-request-works-on-chrome-but-not-on-postman%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            After putting a console.log(req.body) under the Router I found out that apparently the GET method doesn't allow a body, so I was basically sending an empty query. I don't know why it worked on Postman but all I had to do was change the method I use in the API to router.post instead of router.get.






            share|improve this answer




























              0














              After putting a console.log(req.body) under the Router I found out that apparently the GET method doesn't allow a body, so I was basically sending an empty query. I don't know why it worked on Postman but all I had to do was change the method I use in the API to router.post instead of router.get.






              share|improve this answer


























                0












                0








                0







                After putting a console.log(req.body) under the Router I found out that apparently the GET method doesn't allow a body, so I was basically sending an empty query. I don't know why it worked on Postman but all I had to do was change the method I use in the API to router.post instead of router.get.






                share|improve this answer













                After putting a console.log(req.body) under the Router I found out that apparently the GET method doesn't allow a body, so I was basically sending an empty query. I don't know why it worked on Postman but all I had to do was change the method I use in the API to router.post instead of router.get.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 16 '18 at 16:30









                Gustavo MaximoGustavo Maximo

                11




                11
































                    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%2f53341577%2fget-request-works-on-chrome-but-not-on-postman%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

                    Florida Star v. B. J. F.

                    Danny Elfman

                    Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues