Example for the RAML file in Anypoint studio - maven

I currently follow this tutorial: https://docs.mulesoft.com/anypoint-platform-for-apis/creating-an-apikit-project-with-maven but I have a problem in creating the RAML file I don't know how to do this and I have to take the information from these two APIs:
• http://www.programmableweb.com/api/wikipedia
• http://www.programmableweb.com/api/weather-channel
#%RAML 0.8
title: Title
version: 1.0
baseUri: http://server/api/
schemas:
- Countries: |
{
"$schema": "which link",
"type" : "",
"properties" : {
}
}
Is Schemas what need to use?
The final goal is to create an API giving some information about cities and countries. In order to do that, I need to communicate with some others API providers (the two links above) toobtain information and craft the JSON response to return the required information..

The RAML is the contract of the RESTful API you want to expose. So, first you need to understand how to code a RAML:
http://raml.org/
Then you can use the component APIKit in Anypoint Studio that generates the flows based on your RAML.
https://docs.mulesoft.com/anypoint-platform-for-apis/apikit-tutorial
After that you will want to connect to third party APIs like wikipedia or weather channel. For that you can use the HTTP Request Connector if those APIs are REST.
https://docs.mulesoft.com/mule-user-guide/v/3.7/http-request-connector
If those APIs are SOAP based you have to use the Webservice Consumer component, that automatically infers the content of the wsdl and you can choose wich method to invoke, and set the necessary parameters.
https://docs.mulesoft.com/mule-user-guide/v/3.7/web-service-consumer
To do the transformations from your received data to the third party APIs data, you should use Dataweave
https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave
I also recommend the walkthrough tutorials, for designing, building and deploying a new API.
https://docs.mulesoft.com/anypoint-platform-for-apis/anypoint-platform-for-apis-walkthrough

Related

Swagger API Documentation and Server stub Generation

How do I manage newer versions of API specs. Lets take a simple hypothetical scenario, during my design phase I have version v1 for getEmployee with response model as Employee {String name; String age} and developer have generated the server stubs/server code and implemented the functionality and in Production.
Now during next release there is an enhancement either to add/remove new fields into the response model Employee. This would involve designer to change the specifications and developer to rerun the swagger-codegen again with the updated specifications? Can It be automated? Also how should the test cases that are written using swagger specs be updated (Manually)?

Services.AddTransient() Vs Services.AddBot()

In the latest bot samples, we can see that bot is being added to services collection as below
services.AddTransient<IBot, MyBot>();
but in older samples, we saw below approach
services.AddBot<MyBot>(options => { });
Here I am trying to understand the benefits of adding bot using AddTransient() over using AddBot().
What I know is that internally AddBot uses AddTransient only, then why use AddTransient. Referred remarks section from this link.
You can see in the source code that the AddBot methods are used for automatically adding a bot adapter to DI in addition to the bot and for configuring bot-related options like credentials and error handling. The conventions for using the Bot Builder v4 SDK were very different when those samples were made, and the bot's configuration along with its credentials were loaded from something called a bot file. The current convention for using the SDK is much easier because it takes advantage of ASP.NET Core automatically loading the app's configuration from appsettings.json. Since we're not using AddBot anymore you'll notice that the adapter is added to DI explicitly, and you can configure things like error handling and middleware either by accessing the properties and methods of the adapter directly or by deriving your own adapter class, as seen in the samples.

Amadeus Hotel API Images

Is there any way for me to get Hotel's room images from your self-service API? Does the enterprise API support this functionality?
Based on your own documentation this type of information should be available through the following tag:
"media": [{
"uri": "string"
}]
but I'm not getting this tag using any of the search criteria that I'm currently testing with.
EDIT
This question was related to the Hotel Search API v1 in the new version available (v2) the view=FULL is set by default.
You need to add:
view=FULL
In your query to get the media.
For example:
https://test.api.amadeus.com/v1/shopping/hotel-offers?cityCode=LON&view=FULL
Note: we only have a few images in the test environment, most of the responses contain a fake image.

Does the JIRA REST API support querying a list of labels?

I see the is the ability to get all components of a project by doing
/project/[projectkey]/components
but I don't see any capability or documentation on how to get the list of labels that are available for a project (something like:
/project/[projectkey]/labels
Does the JIRA REST API support querying the list of labels available on a project?
Just to clarify, labels (at least the built-in JIRA ones) are global entities so they can be attached to any Issue in any Project.
As to your question - no, there's no public REST endpoint to get/change/add labels to JIRA.
Jira Cloud has /rest/api/3/label.
Jira Server provides /rest/api/2/jql/autocompletedata/suggestions?fieldName=labels which is however not paginated and only returns the first few labels (label values can be queried using &fieldValue=X).
However, as hacky workaround you can misuse the API endpoints some Atlassian Jira Gadgets are communicating with. Though this has the following disadvantages:
Are internal APIs
Atlassian apparently plans to replace Gadgets with Dashboard Items eventually
Might change behavior, see e.g. JRASERVER-67446
No pagination (?), responses can be huge
Responses are designed for Gadgets, therefore contain irrelevant data
Labels Gadget
/rest/gadget/1.0/labels/gadget/project-<PROJECT_ID>/labels
Where <PROJECT_ID> is the numeric ID of the project.
Heat Map Gadget
/rest/gadget/1.0/heatmap/generate?projectOrFilterId=<PROJECT_OR_FILTER>&statType=labels
Where <PROJECT_OR_FILTER> can be either:
project-<PROJECT_ID>
filter-<FILTER_ID>

Apiary: Export API as JSON, to generate client code

We all know that apiary rocks (or not.. I think it does), and I was wondering what would it take to take it a step further allow users to export a JSON description of the API? (So developers can script client code generation)
This should help:
http://ttezel.github.io/blog/2013/02/23/stop-writing-rest-api-clients/
There are two directions you can explore:
you can use Alpaca to generate client SDKs. Alpaca accepts API Blueprint as one of it's input formats
for more flexibility, you can use Snowcrash to parse API Blueprint into JSON - and roll your own code generator.
There are more tools around API Blueprint available at http://apiblueprint.org/

Resources