I'm trying to list service plans usinf the cf api:
from cloudfoundry_client.client import CloudFoundryClient
target_endpoint = 'https://api.ng.bluemix.net'
client = CloudFoundryClient(target_endpoint, skip_verification=False)
client.init_with_user_credentials(
ibm_id,
ibm_id_password
)
import json
for sp in client.service_plans.list():
print(sp['entity']['name'],
sp['entity']['description'])
I was hoping to see a list of services with meaningful names and description as are listed in the bluemix web console, however, some of the responses I'm receiving don't really have much meaning, e.g.
(("100mb", "Basic"), ...)
Which minimal set of fields do I need to extract to list the services?
The API endpoints are listed in the docs, and the ones of interest to you are List Service Plans and Service Plan Details.
You can also get information about everything offered by a Service Broker by hitting its Catalog endpoint.
Related
if i developed API that return list of offers(v1/offers), or it return details for specific offer(v1/offers/12345), is it a good practice to return all offers details when calling /offers list to mobile? to Reduce calls for Offer Details API?, so instead of calling v1/offers/12345, all details for 12345 will be returned when calling v1/offers
thanks
REST does not dictate how to solve this.
It is perfectly okay for a REST API to declare a query parameter or HTTP header by which the API client can declare the required level of detail (e.g. minimal / compact / detailed).
This prevents underfetching (where the client first gets the list of offer IDs and then has to fetch every individual offer) as well as overfetching (returning details of each offer that the client wasn't even interested in) but it requires the API client to take this decision. Whether that is "good" or not depends on how many API clients you have and how different their usage requirements are.
We have a recipe in our mobile application, this recipe has a details screen and the details screen has a lot of information, for example:
Rating
Related recipes
Ingredients
Recipe info
Nutritional info
So is that right to return all this info in the same endpoint or create multiple endpoints for each section?
One endpoint example:
GET: https://www.example.com/api/v1/{recipeId}
Multiple endpoints example:
GET: https://www.example.com/api/v1/{recipeId}/info // this API will return all info including the ingredients
GET: https://www.example.com/api/v1/{recipeId}/rating
GET: https://www.example.com/api/v1/{recipeId}/related
GET: https://www.example.com/api/v1/{recipeId}/nutritional
It depends.
If a consumer of your API is say a web page where you want to display all the information at the same time in one click, you can just bring all information together and display in one go rather than calling APIs one by one and then aggregating, however if there is possibility that individual endpoints are also required to be called separately, then you can expose multiple endpoints.
Also,your resource uri should be like this :
/api/v1/recipes/{recipeId}
In this case, you can create a single API endpoint. And, can expose a query parameter which shows which are the fields user (rest client, web) is interested in.
/api/v1/recipes/{recipeId}/?fields=all
/api/v1/recipes/{recipeId}/?fields=info,rating,related
/api/v1/recipes/{recipeId}/?fields=info
In this way, you will be saved from the headache of writing multiple endpoints for a single serving type.
Also, the schema of output message or JSON will be the same.
Maybe in future, you want to add another field to your response. You just need to add another filter name. Your client (web/rest) doesn't need to use a new API for that. Just pass the new filter and done.
I have been looking for reconciliation services with ontorefine in graphDB. In the following link
https://medium.com/wallscope/linked-data-reconciliation-in-graphdb-cd2796d2870b reconciliation is performed with the DBpedia endpoint. I want to reconcile with another endpoint. What are those other endpoints that I could reconcile with? Are they the same ones that OpenRefine uses? like VIAF, wikidata and others. Or can I use any endpoint?
You can add external reconciliation in the OntoRefine. Click on the column you want to reconcile -> Reconcile -> Start reconciling -> Add standart service.
You can use any reconciliation server (endpoint) in OntoRefine.
In addition:
We've developed a VIAF recon server that's much better than previously existing ones. It takes into account name variants, parses out nationality and occupation, and sorts candidates by some "importance" metrics. We have not yet deployed this as we're looking for a client.
You can implement recon over RDF data, using the same framework that the above VIAF server uses (which is based on mapping RDF props to Lucene/Elastic and using its "similar" functionality). Again, we're looking for a client or pretext to release this framework as part of GraphDB.
OntoRefine is not just a reskinned and rebranded version of OpenRefine, but it adds the ability to render tabular data as RDF (like the obsolete DERI extension):
either by a mapping UI or SPARQL
either for download or direct insert (materialization) to GraphDB (using INSERT over internal federation)
Since it's proprietary and closed source, it's hard to say for sure, but "OntoRefine" appears to be just a reskinned and rebranded version of OpenRefine, so I assume that it can use all the same reconciliation services.
You can find a list of OpenRefine reconciliation services here: https://reconciliation-api.github.io/testbench/
Confirming what Konstantin and Tom wrote, you can use any Reconciliation service with OntoRefine. I've added 3 lists of such services at https://openrefine.org/download.html:
https://github.com/OpenRefine/OpenRefine/wiki/Reconcilable-Data-Sources : maybe a bit older but more descriptive
https://reconciliation-api.github.io/census/services/ : software
https://reconciliation-api.github.io/testbench/#/ : online services
SoftLayer's API has different "services" for the different objects represented in the API. Virtual Guests, Bare Metal Servers, VLANs, IP addresses, etc are all different types of services. There are also links between these services, so I want to use a single API query to get information about multiple services. The Object Mask is one way of joining the different services.
Can anyone please tell me how to achieve it using object mask.
Here you can see information about object mask:
http://sldn.softlayer.com/article/object-Masks
Now all the services are attached to your account, so you need to take a look to the service:
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Account
http://sldn.softlayer.com/reference/services/SoftLayer_Account
The service provides several methods to get differents services such as virtual guest:
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getVirtualGuests
or get all the bare metal servers in your account:
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getHardware
Using Object mask you just need to call the getObject method and add the properties that you want for example see this RESTFul to get the virtual guest, bare metal servers and VLans:
GET https://$USERNAME:$APIKEY#api.softlayer.com/rest/v3.1/SoftLayer_Account/getObject?objectMask=mask[virtualGuests,hardware,networkVlans]
So you can get all the information that you need in a single request however, when your response contains a big amount of data your request will throw an exception, in order to handle that you need to use result limits in your request you can see more information about how to add it to your request here:
https://sldn.softlayer.com/article/REST
Regards
I have an android application connected to magento server by rest api. The application must preform some actions, but I have no examples of requests needed for the application.
For example I have this list of requests, but it is superficial enough for my application. For example, I do request:
"http://myUrl.com/api/rest/products?limit=15" and receive the list of 15 products. But after I need to receive next 15 product, and next, and next... What request can do it?
Also I need to do another requests which have no in site examples.
Where can I get more information and examples about rest api requests? Thank You in advance.
You can use various get filters available for REST request in magento GET FILTERS. To access second page you can use page filter available i.e. "http://myUrl.com/api/rest/products?limit=15&page=2". You can also combine many filters and use them as you want. Eg. For getting a result of products which have their name like 'product123', you can use: magentohost/api/rest/products?filter[1][attribute]=name&filter[1][like]=%product123%.