Append Row with PHP Library - google-sheets-api

I'm using the Google PHP Library https://github.com/google/google-api-php-client and am trying to append data. According to the docs, https://developers.google.com/sheets/samples/writing#append_values, it's possible. The issue is that the main Sheets Service, Google_Service_Sheets_Resource_SpreadsheetsValues(), does not have an append method, only update (and some others that won't help here).

See Google sheets API 4: How to append to the end of the row with PHP, asking the same question. The PHP client library is out of date and missing the append method. I'll report back on that other SO thread when it's fixed. Sorry about that!

Related

Is there a SpreadsheetApp.flush() option for the Google Sheets API?

I have a spreadsheet that I send data to it, I generate a 1-minute sleep (import time → time.sleep(60)) in the code to make sure that the calculations have all been done and then I copy the result of these calculations to another page of that same spreadsheet.
In Google Apps Script there is the SpreadsheetApp.flush() option to make sure that everything in the spreadsheet is perfect to continue the code.
But what about when we use the Google Sheets API, is there a way to do this instead of putting a sleep with a random value like I do?
I was curious about that too, so I reviewed the documentation, and it seems that there is no flush() method for Sheets API.
However, I found a workaround that might help so you can make sure that you are working on the latest version of the sheet. I took inspiration from the Writecontrol parameter in Google Docs API.
"Determines the revision of the document to write to and how the
request should behave if that revision is not the current revision of
the document."
So what I was thinking is to use the Drive API Revisions by using the Revisions: list method and get the latest version of the Sheet. After that, use Revision: get to retrieve the latest version of the sheet to work on it.
You can also submit a missing feature, Google might add this method to the Sheets API later on.
Reference:
Flush() method.
Writecontrol Google Docs API.
Changes and revisions overview.
Revisions: list.
Revisions: get.

Getting a table from wikipedia article from it's API

I need to use the table in from this wiki page https://en.wikipedia.org/wiki/List_of_most_visited_museums to make a database in python (though the latter part is irrelevant atm). I have to use the API (can't scrape) to access it. Right now I'm trying the API's documentation https://www.mediawiki.org/wiki/API:Parsing_wikitext#Example_1:_Parse_content_of_a_page Example #2 from this page is exactly what I want to do, but it's returning an error, and even running the original code in my notebook it also returns an error. Can anyone tell me how to either alter that code so it runs, or direct me to another way to do the same thing? Thanks.
This fetches the content you're after: https://en.wikipedia.org/w/api.php?action=parse&page=List%20of%20most%20visited%20museums&prop=wikitext&section=2&format=json
If the example isn't working in your notebook, the problem probably lies with the rest of your code and not with the API call.

Endpoint with Google Flex env

There is bit of a confusion, wondering if somebody can help me with this.
Here is an example which is a year old and uses goapp with polymer and endpoint
https://github.com/googlesamples/cloud-polymer-go
Here is a recent example using gcloud
https://github.com/GoogleCloudPlatform/golang-samples/tree/master/appengine_flexible/endpoints
Both are different as google changed its approach.
As per second example, I am able to create endpoint functions which uses json for input and output. However there are 2 problems
1st. It is throwing error if I put functions in different file under same package. It works when I run go run .go. but then I dont understand how app.yaml come into picture. I think this url /_ah/spi/. should work
2nd. I am using postman app to check the request and response from endpoint. Is there a better way? I thought google does provide a platform to test endpoint.
Is there any example which implements examples similar to 1st one with new libraries?
looking forward for your help. Thanks.

How to write filter {key} for a 'get items as xlsx' request via Podio API

I'll get this out of the way first: I'm an amateur programmer (at best)...i have some knowledge of how APIs work, but little to no experience manipulating the podio API directly (ie I use zapier/globiflow a lot and don't write any php/ruby). I'm sure other people can figure this out via the API documentation, but I can't. So i'm really hoping someone can help clarify and give some more detailed instruction.
My Overall objective:
I frequently export podio files as xlsx from the podio front-end. This is used by my team and me to do regular data analysis tasks in excel. I would like to make this process easier by automating the function of getting an updated podio export into my excel. My plan is to do this via excel VBA. I understand from other searching that it is possible to send an HTTP request using VBA, so i want to make sure i understand what I need to send to the Podio API to get what I need. The method of how to write the HTTP request in excel VBA is outside the intentional scope of this question (though i'd accept any help on this!)
What I've tried so far:
I know that 'get items as xlsx' is part of the podio API: https://developers.podio.com/doc/items/get-items-as-xlsx-63233
However I cannot seem to get this to work in the sandbox environment on that page so that i can figure out a valid request url. I get this message: 'Invalid filtering key' ... because i have no idea how to fill in that field. The information on that page is not clear on this. Nor is it evident on the referenced 'views page'. There are no examples to follow!
I don't even want to do any filtering. I just want to get ALL items in the app. Or i can give it a pre-existing view_id, but that doens't seem to work either without a {key}
I realise this is probably dead simple. Please help a noob? :)
Unfortunately, the interactive API sandbox does not behave appropriately for this particular endpoint. For filtering, this API endpoint expects query string parameters where the field-value pairs consist of integer field IDs and the allowed values for each field. Filtering by fields is totally optional. It looks like this sandbox page isn't built for this kind of operation with dynamic query string field names; wherever you see the {key} field on that page is meant as a placeholder for whatever field IDs that you would use for filtering.
If you want to experiment with this endpoint, I would encourage you to try another dedicated HTTP client first. I was able to get this simple example working with the command-line program wget:
wget --header="Authorization:OAuth2 $MY_SECRET_TOKEN" \
--content-disposition \
"https://api.podio.com/item/app/16476850/xlsx/"
In this case, wget downloaded an Excel file containing all the items in my app without any filtering applied. The additional --content-disposition argument tells wget to save the output as a file with a name using the information in the server's Content-Disposition response header.
With a filter applied:
wget --header="Authorization:OAuth2 $MY_SECRET_TOKEN" \
--content-disposition \
"https://api.podio.com/item/app/16476850/xlsx/?130654431=galaxy"
In this case, the downloaded file filtered the results to items where field id 130654431 (which is a category field) contain the value galaxy.

Rebol SOAP Server

Where can I find the source of the soap server in rebol mentioned here:
http://www.rebolplanet.com/zine/rzine-1-02/#sect6.
the link http://www.compkarori.co.nz/reb/discordian.txt doesn't work any more.
It's also now in my GitHub repo
https://github.com/gchiu/Rebol2/blob/master/Scripts/discordian.r
Whenever you have this sort of question, try pasting the URL into the search box of archive.org (The Internet Archive).
In this case, a copy of the file was snapshotted in 2004:
http://web.archive.org/web/20040205210622/http://www.compkarori.co.nz/reb/discordian.txt
(You might let the operators of the site know the %reb/ directory is missing, since the others in the set are still there.)