0

I'm new to working with APIs/CURL and trying to figure out how to get a response (not response code) into a sheet. Here's my code:

function myFunction() {
  var url = "https://platform.quip.com/1/threads/[Thread_Id]";
  var headers = {
             "contentType": "application/json",
             "headers":{"Authorization": "Bearer [Token]"}
             };

  var response = UrlFetchApp.fetch(url, headers);
  var text = response.getResponseCode();
  var dataParse = JSON.parse(response.getContentText());
  var dataStr = JSON.stringify(response.getContentText());
  Logger.log(text);
  Logger.log(dataParse);
  Logger.log(dataStr);
}

For testing, I've tried outputting the dataParse and dataStr with the following results:

dataParse

{user_ids=[], shared_folder_ids=[abcdabcd], expanded_user_ids=[abcdabcd], html=<h1 id='abcdabcd'Test Report</h1>

<div data-section-style='13'><table id=......<br/></td><td id='s:abcabcabc' style='background-color:#F5FAFF;'><span
 id='s:abcabcabc'>Active (Product)</span>....

dataStr

{\"thread\":{\"author_id\":\"abcabcabc\",\"thread_class\":\"document\",\"id\":\"abcabcabc\",\"created_usec\":123456789,\"updated_usec\":123456789,\"title\":\"Test
Report\",\"link\":\"https:\\/\\/quip.com\\/abcabcabc\",\"type\":\"spreadsheet\"},\"user_ids\":[],\"shared_folder_ids\":[\"abcabcabc\"],\"expanded_user_ids\".....

So my question is: Is there a way to convert either of those results into a Google Spreadsheet or will I need to write my own conversion function? Or am I coming at this from a completely wrong angle?

(Side question, the results returned in Logger.log are way less than the actual results when using CURL. Does Logger truncate results?)

bumped to the homepage by Community yesterday

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

0

Is there a way to convert either of those results into a Google Spreadsheet or will I need to write my own conversion function? Or am I coming at this from a completely wrong angle?

You have to build your own conversion function or get one from someone else.

Regarding the side question, log doesn't mention limits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.