How to fetch JSON using an object with request-promises


#21

Hi @Nic please be assured I understand what you meant. And I am really happy to be a part of this community. One of the most active communities which is always always looking forward to help people like me. Great feeling!

And yes! please DO NOT use the word “apology”. I am feeling very awkward, trust me.


#22

Cool :slight_smile:

Let me know how you get there with the post call


#23

Hi @emfluenceindia, did you figure out how to get body details?


#24

@Suki yes, by using GET method I have been able to fetch records from API endpoint. This is how I am using it:

    const request = require("request-promise");
    ...
    contact_lookup_by_id: async contactId => {
        let data = {};

        await request({
          url: apiBase + "contacts/lookup",
          qs: {
            accessToken: accessToken,
            contactID: contactId
          },
          method: "GET"
        })
          .then(body => {
            data = JSON.parse(body);
          })
          .catch(error => {
            console.log(error);
          });

        return data;
      },

#25

@emfluenceindia Thanks alot!