Quillinoz api with Oauth

Viewed 29

I am struck with Quillionz API. About this API. Not less than 300 word-limit text should be give as post request and in get request the questions will come. I was calling this api with OAuth.

check out my API details with all credentials. https://app.quillionz.com:9443/devportal/apis/3f38a2dd-9cb3-41dc-b11d-e3d3f6f53e70/test

Below code is not working, is there any other way for get and post requests

function getQuestions(content, sender_psid, follow_up, callback){
  console.log("Generating questions");
  const headers= {
    'Content-Type': 'text/plain',
    'Authorization': `Bearer ${process.env.AUTH_TOKEN}`
  }
  axios.post(process.env.CALLBACK_URL, content, { 
    headers: headers
  })
  .then(function(response) {
      console.log(".....................................................");
      console.log(response.data.Data);
      console.log(".....................................................")
      var ques = [];
      var corr_ans = [];
      var user_ans = [];
      var obj;
      for ( obj of response.data.Data.recall){
        ques.push(obj.Question);
        corr_ans.push(obj.Answer);

        if(ques.length==5){
          break;
        }
      }
      console.log(JSON.stringify(ques));     
      callback(sender_psid, res, follow_up);

  })
  .catch(function(error) {
      res = createResponse(process.env.ERR_Q);
      callback(sender_psid, res);
      console.log(error);
  });
}

0 Answers
Related