Skip to content

Latest commit

 

History

History
106 lines (89 loc) · 3.06 KB

sync-api-apisync.adoc

File metadata and controls

106 lines (89 loc) · 3.06 KB

Update your API Definition and Sync it With Anypoint Platform

When you update a RAML file from Anypoint Studio, the API Sync view allows you to synchronize those changes to your API version hosted in Anypoint Platform.

Prerequesites

To illustrate this quickstart, we are assuming you implemented the t-shirt.api project in Studio.

Note

In order for API Sync to work, you need to edit an API in Studio that was imported from the Anypoint Platform.

Edit Your RAML File using The RAML Editor

Navigate to your t-shirt.raml file in your Package Explorer, double-click in it to open the file in your RAML Editor.

Locate your /orders:` resource definition, and right after the defined schema for the post: resource:

schema: |
  {
    "type": "object",
    "$schema": "http://json-schema.org/draft-03/schema",
    "id": "http://jsonschema.net",
    "required": true,
    "properties": {
      "address1": {
          "type": "string",
          "id": "http://jsonschema.net/address1",
          "required": true
      },
      "address2": {
          "type": "string",
          "id": "http://jsonschema.net/address2",
          "required": true
      },
      "city": {
          "type": "string",
          "id": "http://jsonschema.net/city",
          "required": true
      },
      "country": {
          "type": "string",
          "id": "http://jsonschema.net/country",
          "required": true
      },
      "email": {
          "type": "string",
          "format": "email",
          "id": "http://jsonschema.net/email",
          "required": true
      },
      "name": {
          "type": "string",
          "id": "http://jsonschema.net/name",
          "required": true
      },
      "size": {
          "type": "string",
          "enum": ["S", "M", "L", "XL", "XXL"],
          "id": "http://jsonschema.net/size",
          "required": true
      },
      "stateOrProvince": {
          "type": "string",
          "id": "http://jsonschema.net/stateOrProvince",
          "required": true
      },
      "postalCode": {
        "type": "string",
        "id": "http://jsonschema.net/postalCode",
        "required": true
      }
    }
  }

Paste the expected response definition for a successful POST request:

responses:
200:
body:
  application/json:
    example: |
      {
        "orderId": "4321"
      }

Synchronize your Updated RAML File With Anypoint Platform

Notice that your API Sync view now allows you to upload your changes through the Upload button:

api-sync-view-raml-update

You can select your raml file and click the Upload button to submit your chances to Anypoint Platform.

To learn more about this in detail, check our API sync reference page.
You can also navigate to your API Designer to check how the updates were pushed.

Download the final t-shirt RAML definition.