Is Google bigquery javascript API be available with gapi.client.request? - google-api

So current javascript api for bigquery leverages RpcRequest for synchronous query api call. Currently I can submit a set of queries in one http round trip by using RpcBatch.
Is there plan to migrate to gapi.client.HttpRequest for bigquery requests in the future? gapi documentation indicates RpcBatch is deprecated and should use HttpBatch instead.
Thanks,

You should already be able to use HttpRequest and HttpBatch with BigQuery. All you need to do is to use the appropriate /bigquery/v2 REST URL to build your request with gapi.client.request.

Related

Can't I create a rest API in the apollo-server?

It is currently being developed using mysql-prisma-apollo server-nexus, and it is necessary to receive row data post using the REST API, not the GrqphQL statement currently developed. You want to process raw data passed to the post in Path (for example,/api/data/status). Is there a way to create a RestAPI on the apollo-server?
The apollo-server runs in a node environment, so you are able to use any http client you want.
Example:
axios
node-fetch

How to use REST API with FaunaDB?

I have created a collection in my Fauna database. I also made an index that returns all the data in that collection. I want to know if there is a way to get JSON REST API to work with this data. What I mean by this is I want a URL that I can 'GET' using XMLHttpRequest and then parse into JSON.
You might say that Fauna is "HTTP native". All of the language drivers (JS, C#, Python, etc.) are built on top of http requests. That is, there are no special connections or connection-pools to maintain. You can get pretty far with using the JS driver in the browser, for example, without using a server.
But to answer your question more directly, there are many ways to serve a REST API, and it is going to depend on how you want to serve the API.
Examples
AWS
Here is a blog post on how to set up a REST API with AWS App Runner, for example.
https://fauna.com/blog/deploying-a-rest-api-with-aws-app-runner-and-fauna
Vercel and Netlify
There are also some example apps on github that demonstrate using a REST API with
Vercel:
https://github.com/vercel/next.js/tree/canary/examples/with-cookie-auth-fauna
Or Netlify:
https://github.com/netlify/netlify-faunadb-example
Both of which host serverless functions for you to create a REST API.

GraphQL endpoint for file download

Is it possible to trigger a file download in a browser from the GraphQL endpoint on an apollo-server-express application?
I have the endpoint written in a standard express app.get function (see below) but I would like to make use of the GraphQL context for file download and so I'm wondering if it's possible to cause a download from a GraphQL endpoint.
Here's a bare-bones example of what I have on the express end in the app.get function:
app.get('/download-batch/:batchId', async (req, res) => {
res.send(new Buffer('test'));
});
Any help would me much appreciated. Thanks!
Yes, but you would be required to create a custom endpoint for that. You can't use the existing endpoint which you are using for making requests.
Using the custom endpoint, you have to add a middleware and process the data into a buffer or whatever format you need. But it would not be recommended. That would again become one more endpoint instead which you can write an API to serve that.(After all graphql is built mainly on the focus of single endpoint).
BoĊĦtjan Cigan mentions here some solutions and gives details about using GraphQL as a proxy with Minio. The backend would ask Mino to generate a temporary link that can be sent back to the browser for direct access.
This is a valid solution for many use cases.

Grafana plugin - CORS issue with REST API

I'm currently developing grafana plugin using Angular-1 and ES6, retrieving data from REST API and representing them in grafana. The problem is that as far as grafana plugin is working within the browser, it sends ajax calls to our REST API and they are blocked:
No 'Access-Control-Allow-Origin' header is present on the requested resource. The response had HTTP status code 401.
We were required to solve this issue without adding that header on the REST API side. One simple solution was to use corsproxy.
But I'm curios to know whether there is some other way to use REST API within grafana. If I set up some datasource to my plugin, will it work as a kind of backend or my calls to REST API will still be AJAX calls?

Are database calls in cloud functions counted as regular request?

As per FAQs of parse.com,
How are requests made from Cloud Code treated under the request limit?
Calling a Cloud function will count itself as a single request. Save and delete triggers in Cloud Code are considered part of the original object save/delete request, and they will not be counted as an additional request. However, if your function or save/delete trigger uses the Parse JavaScript SDK to perform additional operations, these will be treated in the same way they would as if they were made by a regular client.
What does using JS sdk in cloud code exactly mean? If i make simple database call like query.find from a cloud function or trigger then will that be counted as regular client request?
Yes query.find will be a database request. Any query execution wil be.

Resources