Google CRUD Migration from SQL API to Fusion Tables API - google-apps-script

I used Ferris Argyle's CRUD from the Google Apps Developer Blog and now must migrate this SQL API to Fusion Tables API. The full code is here. So far my efforts have left me with a code 404 error and lots of this:' <HTML><HEAD><TITLE>Not Found.' Ideally this example CRUD would be updated by Google but lacking an update perhaps someone could offer guidance.
What i've updated from the migration guide.
Turned on API, Removed numberic ID's, Updated libraries (None for me), updated URL end point.
added '&alt=csv' to query parameter.
added '&key=MyEncriptedAPIKey'.
I am unsure if OAuth in the CRUD must be updated.
I am unsure of the relationship between API Key and OAuth, do i need both or one.
Can anyone look at the example CRUD and tell me what i'm missing? i'm a novice with Javascripts, Google Apps, OAuth so examples or links are welcome.
thanks,
Scott "if it ain't broken don't fix it" B

Unfortunately Google Apps Script doesn't currently doesn't have native support OAuth2 authentication, which is required to by the new Fusion Tables API to access private data. Some users have had success implementing parts of the OAuth2 flow themselves in Apps Script, but as a novice this may not be feasible. If you are only accessing public data then you should be able to get by just using the API key.

Related

How do I quickly list all Google Cloud projects in an organization?

I would like to quickly list all Google Cloud projects in an organization, without AppScript folders.
gcloud projects list can be very slow. This documentation is about speeding it up, but does not show how to retrieve the Appscript folder which is used for filtering. Can that be done from the command line?
Also, gcloud projects list does not have a way to filter by organization. It seems that that is impossible as projects are not linked to their organization except through a tree of folders.
The documentation shows a way of walking the tree, apparently with Resource Manager API, which might do the job, but only pseudocode is shown. How can this be done with gcloud -- or else with Python or another language?
And if there is no way to accelerate this: How do I page through results using gcloud projects list? The documentation shows that page-size can be set, but does not show how to step through page by page (presumably by sending a page number with each command).
See also below for a reference to code I wrote that is the imperfect but best solution I could find.
Unfortunately there isn’t a native Apps Script resource available to work with Cloud Resource Manager API.
Although, it is possible to make a HTTP call directly to the Resource Manager API projects.list() endpoint with the help of UrlFetchApp service.
Alternatively, using Python as mentioned, the recommended Google APIs client library for python supports calls to Resource Manager API. You can find the specific projects.list() method documentation here.
On additional note, if you happen to use a Cloud project to generate credentials and authenticate the API call, you may want to enable Cloud Resource Manager API on your project by following this URL.
I’d also recommend submitting a new Feature Request using this template.
Here is some code that lists projects in an organization as quickly as possible. It is in Clojure, but it uses Java APIs and you can translate it easily.
Key steps
Query all accessible projects using CloudResourceManager projects(), using setQuery to accelerate the query by filtering out, for example, the hundreds of sys- projects often generated by AppScript. The query uses paging.
From the results
Accept those that are the child of the desired org
Reject those that are the child of another org.
For those that are the child of a folder, do this (concurrently, for speed): Use gcloud projects get-ancestors $PROJECT_ID to find the projects in your organization. (I don't see a way to do that in Java, and so I call the CLI.)

Is it possible to enforce a naming standard for an BIM360 Docs folder through the data-management API?

I've been trying to enforce a predefined naming-standard on an Autodesk BIM360 Docs folder.
There exists an API endpoint to get the naming-standard that is enforced for a BIM360 Docs folder by calling
GET projects/:project_id/folders/:folder_id
and also
GET https://developer.api.autodesk.com/bim360/docs/v1/projects/:projectId/naming-standards/:id
to get the details of the defined naming standard.
But there seems to be no public API to enforce a naming standard on a newly created folder. Which is strange since one can set a naming standard via the UI.
I've checked what happens when a user enforces a naming standard via the UI. The UI calls this API
POST /dm/v3/projects/<ProjectId>/folders/naming-standards:batch-enforce
with this data
[{"folderUrn":"<folderId>", "namingStandardId":"<namingStandardId>", "includeSubfolders":false,"operation":"add"}]
I tried calling the same API programmatically and got an error that my registered forge app has no access to the specified api product, although the data-management api is enabled for this app.
Am a little helpless of how to continue. Perhaps someone can give me a push in the right direction?
Thanks
Unfortunately, the naming standard API is READ-ONLY currently. The Write API is still on the way to come. Please stay tuned with us.
Note. The API you found is for Docs Service itself only.

Is there a way to automatically delete emails from a Google Workspace Google Groups?

I was wondering if there is a way to automatically (or on a trigger) delete emails from a Google Group.
I use a Collaborative Inbox Group for archiving automated emails.
I looked at the Google Apps Script overview for Google Groups, but I don't see anything. It only seems like you can do this from GmailApp...
I also read this thread from 2012 but nothing helpful there
Answer:
Programmatically this isn't possible.
More Information:
The GroupsApp class of Apps Script only has read methods available for use - there is not a way of executing any write data using the class - for example deletion of emails.
Emails are sent to everyone in the group when a post is made (as per subscription settings). If you want the Email to be deleted then as you have already pointed out, you will need to use GmailApp to delete it from the recipients' inboxes.
In short: All mailbox manipulation must be done using the Gmail API (or GmailApp).
Feature Request:
You can however let Google know that this is a feature that is important for access to their APIs, and that you would like to request they implement it.
Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services, I'd urge you to make a feature request there. The best component to file this under would be the Admin SDK component, with the Feature Request template.

billing clients for google api's

Questions regarding billing for Google API's or more specifically the places and maps Google API's.
We have an app which is part of a SAAS package. When clients use our Software we have maps and place's API built it, however we want to offset the cost of the bill using these API's to that particular client using the software.
Currently we have a single Google Project we created and enabled the API's on our own google account however this means we will foot the bill as its using our token.
Can clients somehow connect to our google project etc or do we simply need them to create their own google project and pass that token through? Is there a streamlined approach that covers this...
When we did for our multi tenant application we did create only one google project and billing was getting accumulated into a single account. We looked at what you're talked about but since google does not allow to bill separately without having separate google project. Google API billing works on google project id. We decided to bill our clients separately and handled all calls to Places API on a single google project.
Long story short - it was not easy to have our clients connect to our project without having them create their own google project we ended up with one google api project.
edit: also missed another important point - Google My Business API needed whitelisting for each project id so it was another reason to keep it as a single project
Passing the token to the application is a probably very bad idea and will result in a security risk for your client and their token if it is intercepted.
As a developer for the client they should create a token on their account and then they will be charged. They can then give it to you as the developer for use. This is however a gray area as technically you are not allowed to share your tokens with anyone TOC However i believe that client and developer relationship should be secure enough for sharing the token.
Ideally you should give the client the code they can then use their own token and run the application themselves.

How to use the calDAV protocol on a Flex application?

I'm a trainee and am learning about Flex, so I'm a total noob at this... My boss asked me to research the calDAV protocol for us to use in a calendar app we already have. I was trying to understand the Google API but I have no clue how to put this in our code. He wants me to make it possible to share events added to our calendar in Google Calendar or IPhone, for example. I'm starting to get desperate :(
It appears as the Google CalDAV API is deprecated and it will likely go offline at some point soon.
Edit: The Google CalDAV API is not being deprecated, only the previous endpoint. Wording below has been amended to recommend Google's own API as an alternative method.
CalDAV itself is basically just a way to format information about calendar events in a specific way for communicating between services. It also defines how to send and receive this information. Here's the CalDAV specification for more info.
If the requirement is to work with Google Calendar but not specifically with CalDAV, you could look at v3 of their API. It appears to be based more around JSON which should make it slightly easier to work with in AS3. There appears to be AS3 libraries out there for Google Calendar, but they seem to be outdated and unsupported, so it's likely that they won't work with the latest versions of the API.
The Google API relies on REST calls. It basically means that you send HTTP GET, POST, DELETE etc requests to specified URLs on Google's servers to do specific tasks or to request data.
In order to use the API you need to authorize your requests. The most common way to do this is to use OAuth 2.0 - in which your user grants your application access to its Google account, and in turn your application receives a token that needs to be sent with each request.
This isn't a complete answer to your problem, but I hope it outlines the process and gives you some useful links to read.