GraphQL API that doesn't provide introspection. How do we use Apollo with Kotlin? - kotlin

I am working with an API that doesn't have introspection enabled from the back end.
The only thing I have is a curl command to access the API. How do I access it in Kotlin using Apollo?

Related

If there is any tool available for automatically generate the documentation in Laravel through request and response

I have built some REST API in Laravel micro framework and it's working fine. Now I want to automatically generate the documentation in Laravel through request and response into it so the API will be well documented on future use. Has anyone done this?

Expose HTTP GET API in GraphQL Apollo Server v2.0

I am using Apollo Server v2.0 (without middleware) as part of my project and I would like to add support for a HTTP GET endpoint to for file downloads. Is there a way to expose an API endpoint without using apollo-server-express?
Thank you
No. While apollo-server currently uses express under the hood, the Express instance is not exposed as a property on the ApolloServer instance. In order to expose any additional endpoints, you'd need to migrate to apollo-server-express or any of the other available framework integrations. The migration is relatively painless since the APIs are almost identical.

FF4J: REST endpoint as a feature store

I am currently looking at implementing feature toggles using ff4j for our application. We want to have a remote central config app which will hold all the features in it and the applications will talk to this central config app via REST to get the features. We will not be able to leverage Spring Cloud Config or Archaius for this purpose.
I went through the documentation and it seems there is a support for HttpClient (https://github.com/ff4j/ff4j/wiki/Store-Technologies#httpclient). But I couldn't find any sample for the same. Can someone please let me know if I can leverage this method to build my feature store from a REST endpoint. Also, I would appreciate if someone could point me to a sample of this.
This is a common pattern.
A component holds the Administration UI (console) and the REST API. You can call it the "Admin Component". For security reasons It may be the only component to have access to persistance unit (any of the 15 DB implementation available)
For the "admin component" HERE is sample using standAlone spring-bppt application using JDBC DB, and HERE you find a simple web application.
The REST API can be secured using credentials user/password and/or API Key. More information HERE
All microservices access the REST API as clients and request feature store. You will need the dependency ff4j-webapi-jersey2x or ff4j-webapi-jersey1x that hold the client http> Then you can define the store using :
FeatureStoreHttp storeHTT = new FeatureStoreHttp("http://localhost:9998/ff4j");
Warning : Please consider using cache to limit overhead introduce by accessing the REST API at each feature usage. More info on cache HERE

Semantics3 API with AngularJS Authentication

I am in the process of learning AngularJS. I am building a mobile first application using bootstrap 3.1.0.
Basically I want to consume the Semantics3 API and display the products in a list. How can I do this when Semantics3's API needs authentication via OAuth. I already have my API key and secret, but I do not know how to successfully make the call to the API from my Angular controller.
At the moment my code looks like so:
savvyShop.controller('ProductsCtrl', function($scope) {
$scope.apiResult = $http.get('https://api.semantics3.com/v1/products?q={"cat_id":13658,"brand":"Toshiba","model":"Satellite"}')
});
Unfortunately, there would be no way you can do this from the client-side (via AJAX). This is because you're trying to make a cross-domain request, which all Javascript engines do not allow. In general, if the API provides a JSONP endpoint, you could use that to make cross-domain requests. However, Semantics3 does not have one.
You could write a server-side script that effectively acts as a proxy between the client and our Semantics3 servers. It would basically pass on whatever queries you send to our URL, receive the results, and send it to the client. That way, you can use $http.get in AngularJS to run those queries.

Proper auth method against keystone ( openstack )

Should I directly query the API or rely on importing methods from the keystone client?
Thoughts?
It kind of depends on your requirements as to how you want to interact with keystone.
If you're querying the API directly then you're probably using curl in a bash script or from the command line. This can be particularly useful if you're working with bleeding edge keystone API code from trunk that doesn't even have methods in the keystone client yet.
If you're importing methods from the keystone client you're probably writing a python script or application. This is the better option if you're working with stable keystone code from a stable branch or package. The keystone client is just easier to work with rather than raw HTTP requests.
HTH
It's easier to use the keystone client methods. The python-keystoneclient package has documentation on how to do this in the doc directory. For example, see The client API.
I ended up using the python-keystoneclient bindings for initial authentication but for any query outside the scope of the keystoneclient API I simply referenced the auth_token and called to requests for direct API queries against the keystone ec2 url with the token in the header.
This worked well enough. Keystone needs work.