Build REST API top of GraphQL API - api

I'm trying to find a library or something like that, where I can define REST endpoints top on a 3rd party GraphQL API queries mutations.
I found https://github.com/sisense/graphql2rest and https://github.com/Urigo/SOFA but both of these libs are required to be the graphql in exact same place.
Is there any free to use lib for that? Or I have to write an own, because there is no other option.
Thanks for the tips!

Related

Can I use just DirectusSDK instead of REST or GraphQL?

Are there any downsides to use directusSdk instead of making GraphQL requests?
According to documentation; My front-end can log in users and make requests through javascript SDK.
I would say using the SDK is a great option and is something I choose to do myself where possible, I believe that the Directus application uses it too, therefore it is well looked after 😌

Wrap multiple 3rd party GraphQL APIs in a single GraphQL endpoint

Vendors like GitHub are beginning to provide their own GraphQL APIs as an alternative to the existing REST APIs. However many apps shouldn't talk to these APIs directly and instead talk to first-party servers that in turn speak to these APIs.
With REST APIs it's trivial to proxy an entire third-party API from a single endpoint. But the existing GraphQL libraries all seem to need to know the full GraphQL schema in advance and there doesn't seem to be any way to specify queries or types to be defined at run time.
The even bigger problem seems to be that the entire GraphQL query will be parsed in advance. In order to pass on a sub-query to a third-party API that GraphQL fragment would have to be preserved or reconstructed.
Here's an example that doesn't work:
new gql.GraphQLObjectType({
fields () {
return {
thirdPartyApiCall: {
type: '???', // Type is actually defined upstream
resolve () {
// GraphQL sub-query is already parsed at this point
return thirdPartyGraphQLApi(graphQLSubQueryGoesHere)
}
}
}
}
})
I think part of the answer could be to use introspection queries to generate the type in this example dynamically, once, when the schema is loaded (though of course this means it won't reflect changes upstream unless it is re-generated frequently) but I'm at a complete loss as to how to get the original GraphQL sub-query to pass on to the third party.
Is this currently solvable in GraphQL without writing a custom GraphQL parser/handler or does GraphQL currently not support this kind of delegation (i.e. wrapping 3rd party GraphQL APIs directly)?
User #jbinto from the GraphQL community Slack helpfully pointed me at this currently unsolved GitHub issue on the graphql-js implementation: https://github.com/graphql/graphql-js/issues/490
Currently the answer seems to be "it can't be done" but the maintainers are looking into it, now that GitHub created the first major public GraphQL API.
It's worth following the development of the issue on GitHub and seeing what solutions arise from the discussion. The driver may support this scenario in the future or a userland solution may come along that solves it. There are a lot of open questions as to the specifics at the moment.

How to use BigQuery API from elixir code

How to use BigQuery from elixir code?
I would like to use Big Query web API from elixir code. Although there is no elixir client SDK in SDK libraries page
I will use BigQuery API with service account. For using service account, I have to exec "JWT encode"...
Do you know suitable elixir library for using BigQuery API?
BigQuery implements a traditional REST API. If no one has implemented it before, it should be straightforward to create one using a REST library.
REST for elixir:
https://github.com/h4cc/awesome-elixir#rest-and-api
You'll need to authenticate too, OAUTH2 for elixir:
https://github.com/h4cc/awesome-elixir#authentication
It's not a library, but the following repo has some example code for some basic usages on BigQuery (It was just an experiment and pretty much immature, but I'm hoping that it's better than nothing..)
https://github.com/parroty/big_query
I know this is an old question, but looks like this exists now: https://github.com/googleapis/elixir-google-api/tree/main/clients/big_query/
Writing this for folks who come here years later (like I did).

i am trying to use rest api but don't understand where,why and when i should use this

What is the purpose of rest API and where it should be used how can i know that in this part of website i should use rest API any one can tell me in simple words why,where and how can in implement that technology ?
My answer might be not througout and lacking in precision, but it may do.
REST API means serving app (website) API through HTTP requests (mainly)
Thats simple/silly explanation.
Better one is here:
What exactly is RESTful programming?
About when to use it... well.. that depends.
I guess common use case is when you want to expose some part of data/functionality of your site for third party developers. Then you may define URL under which you would return data in json or xml or....

Is a restful API and a backend service (like Parse) the same thing?

Rest confuses me sometimes. I know that it involves creating an API layer over your data and then you make calls to that data through the API. The best way I think of Rest is that the actual Twitter website interfaces with the data-layer through API calls.
That made me wonder then: Is a backend-service like Parse also a Rest API to your data?
What might be the difference between Parse and say, building your own Rest API like this guy did: http://coenraets.org/blog/2012/10/nodecellar-sample-application-with-backbone-js-twitter-bootstrap-node-js-express-and-mongodb/ (he's getting some solid google rankings for his API tutorials).
A simple yes/no might answer the question, but providing details will really be appreciated.
I look forward to the answers.
Parse is built around a restful API just like most, if not all, other mBaaS out there.
A RESTful Api isn't just CRUD operations though nor is it the same thing as Parse. Parse is a company that provides a remote backend to developers using a RESTful api.
RESTful api !== BaaS
I have dealt with about 5 mBaaS and Parse isn't really one of them, but I've glanced at their API reference for JS and I think they use mongodb clusters. An mBaaS usually provides the developer the ability to have cloud storage, push notifications, server side code, easier social media integration, and mobile analytics. So it's not just any backend. Although there are some mBaaS, like Urban Airship, that only supply push notifications to developers.
A RESTful api at it's core usually has some key functions that are centered/wrapped around an httpRequest
They usually use "GET", "POST", "DELETE", and "PUT" to make all calls. Some allow the implementation of rpc for custom server logic. An mBaaS takes a lot of work to implement right and well. You can't build Parse in a Day. It takes a lot of planning and such. The differences between Parse and that guy in link are in the implementation, range of features, and purpose in general(the audience).
To better understand REST maybe look here you can also read the HTTP spec if you are feeling adventurous.