MicrosoftDocs / Advertising-docs

Creative Commons Attribution 4.0 International
15 stars 59 forks source link

Getting Error code #927

Closed judelytics closed 3 years ago

judelytics commented 3 years ago

I tried using this code and I'm getting the following error:

{ "error": { "code": 404, "message": "Requested entity was not found.", "status": "NOT_FOUND" } }

Is there anything that should be updated to the code?

Thanks


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

eric-urban commented 3 years ago

@judelytics one of my teammates suggested this might happen if you are trying to access a non-existing file under your Google account. Can you please double check? Otherwise do you have line numbers or method names from the error call stack?

judelytics commented 3 years ago

@eric-urban Hello Eric, this was my first assumption as well, but given that I am able to log data from the Google Sheet in the Microsoft app script log, meaning the file exists and is working fine.

However, the code won't write data in the Google Sheet.

I'm getting an error at line 156 (throw response)

var url = baseUrl + urlPath; if (queryArguments.length > 0) { url += '?' + queryArguments.join('&'); } var httpResponse = UrlFetchApp.fetch(url, { contentType: 'application/json', method: method.httpMethod, payload: JSON.stringify(body), headers: { Authorization:Bearer ${accessToken}}, muteHttpExceptions: true }); var responseContent = httpResponse.getContentText(); var responseCode = httpResponse.getResponseCode(); var parsedResult; try { parsedResult = JSON.parse(responseContent); } catch (e) { parsedResult = false; } var response = new Response(parsedResult, responseContent, responseCode); if (responseCode >= 200 && responseCode <= 299) { return response; } throw response;

Thanks

judelytics commented 3 years ago

@eric-urban Any chance you can share the Google spreadsheet you are using in this example to see the setup and help understand the whole logic behind it.

Thanks

eric-urban commented 3 years ago

@judelytics For this example we just created a regular spreadsheet, didn't do anything special. Please double check if you didn't pass the correct spreadsheet id to the update method. Can you share a minimal repro that does both reading from the spreadsheet and updating the spreadsheet? We would need the exact code you are running (with any secrets removed of course).

judelytics commented 3 years ago

@eric-urban ok. If I want the script to run daily, is there a way to get the refresh token updated automatically in the code?