Search code examples
mavenramlanypoint-studio

Example for the RAML file in Anypoint studio


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..


Solution

  • 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