Skip to main content
Question

/v2/calls/extensive - Error "Request message not readable"

  • October 21, 2024
  • 2 replies
  • 93 views

Forum|alt.badge.img
const myHeaders = {
   'Content-Type': 'application/json',
   'Authorization': 'Basic XXXXXX'
 };

function findGongCallByDate(when) {

  const raw = JSON.stringify( {
    'contentSelector': {
      'context': 'None',
      'exposedFields': {
        'collaboration': {
          'publicComments': true
        },
        'content': {
          'pointsOfInterest': true,
          'highlights': true,
          'callOutcome': true,
          'keyPoints': true
        },
        'parties': true
      }
    },
    'filter': {
      'fromDateTime': '2024-10-18T07:00:00-08:00',
      'toDateTime': '2024-10-21T09:00:00-08:00'
    }
  } );

  const requestOptions = {
    method: "POST",
    headers: myHeaders,
    body: raw,
    redirect: "follow",
    muteHttpExceptions: true
  };

  var response = UrlFetchApp.fetch("https://api.gong.io/v2/calls/extensive", requestOptions);

  console.log(response.toString());

}


function getAllGongCalls()
{
  const requestOptions = {
    method: "GET",
    headers: myHeaders,
    redirect: "follow"
  };

  var response = UrlFetchApp.fetch("https://api.gong.io/v2/calls", requestOptions);

  console.log(response.getContentText());
}

The above code has 2 functions.

  1. getAllGongCalls - which works great.

  2. findGongCallByDate - which fails with the below error

{"requestId":"1efp7ktsac4zd2g13el","errors":["Request message not readable"]}

 

Any idea what is wrong with it?

2 replies

Andrew O'Driscoll
Forum|alt.badge.img+4

@eran did you figure out what was going on? 

Long shot, but have you tried changing body: raw to body: json since you are passing JSON?

I verified your JSON looks good by copying and testing in Postman


Forum|alt.badge.img
  • Author
  • Community Newbie
  • 1 reply
  • October 28, 2024

This code was generated by Postman, it works just fine, only problem it’s not executing it anywhere else.

 

I even exported my posman call to curl and that worked as well as-is.

 

(I also tried your suggestion, but it had the same error message)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings
×