|
1 | 1 | = Creating and Importing API Specifications |
2 | 2 | :page-deployment-options: cloud-ide, desktop-ide |
3 | | -:page-aliases: des-test-api-specs.adoc |
| 3 | +:page-aliases: des-test-api-specs.adoc, ui-tut-design.adoc, tut-af-design-api-specification-from-scratch.adoc, design-api-specification.adoc, test-api-specification.adoc, tut-af-design-am-flights-api.adoc, tut-af-design-api-test-specification.adoc |
4 | 4 |
|
5 | 5 | include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] |
6 | 6 |
|
7 | 7 | Use Anypoint Code Builder to create, import, and test API specs before publishing to Anypoint Exchange. You can start a new spec from the IDE or import an existing spec from MuleSoft Version Control System (VCS). |
8 | 8 |
|
9 | 9 | . Create a API spec project in Anypoint Code Builder from the IDE or by importing the spec from MuleSoft VCS: |
10 | 10 |
|
11 | | -* <<design-new-api-spec, Create an API spec project from the IDE>> |
| 11 | +* <<design-new-api-spec, Create an API spec project from the IDE>> (example uses OAS 3.0 (YAML)) |
| 12 | +* <<create-raml-rest-api-spec, Create an API spec project using RAML 1.0>> |
12 | 13 | * <<import-spec, Import an API spec from MuleSoft VCS>> |
13 | 14 |
|
14 | 15 | . <<open-output-panel, Track progress in the output panel>>. |
15 | 16 | . <<review-spec-console, Review your spec in the API console>>. |
16 | 17 | . <<test-spec, Test your spec using the mocking service>>. |
17 | 18 |
|
18 | | -Use the <<example-oas-api-spec,`oas-example`>> API spec to explore the functionality of Anypoint Code Builder. |
| 19 | +Use the <<example-oas-api-spec,`oas-example`>> API spec to explore the functionality of Anypoint Code Builder with OAS, or see <<create-raml-rest-api-spec, Create a REST API Specification Using RAML 1.0>> for a RAML-first project. |
19 | 20 |
|
20 | 21 |
|
21 | 22 | == Before You Begin |
22 | 23 |
|
23 | 24 | * xref:start-acb.adoc[Set up and access the web or desktop IDE]. |
24 | 25 | * Understand the basics of designing API specs. |
25 | 26 | + |
26 | | -See the xref:tutorials.adoc[] for details. |
| 27 | +See xref:tutorials.adoc#modular-learning-paths[Take Your API Specification from Design Through Deployment] for a suggested order of topics. |
27 | 28 | * Have some familiarity with xref:access-management::business-groups.adoc[business groups]. |
28 | 29 | + |
29 | 30 | When you publish your API spec to Exchange from Anypoint Code Builder, the IDE requests the name of the business group. See xref:access-management::business-groups.adoc[]. |
@@ -79,6 +80,67 @@ image::des-oas-create.png[New OAS 3.0 (YAML) API project] |
79 | 80 | + |
80 | 81 | As you enter elements, use xref:start-discover-ui.adoc#auto-complete[auto-complete] (or press Ctrl+Space) to display available options within the context. |
81 | 82 |
|
| 83 | +[[create-raml-rest-api-spec]] |
| 84 | +== Create a REST API Specification Using RAML 1.0 |
| 85 | + |
| 86 | +To create a REST API specification project that uses RAML 1.0: |
| 87 | + |
| 88 | +// Open the ACB IDE |
| 89 | +include::partial$acb-reusable-steps.adoc[tags="open-ide"] |
| 90 | ++ |
| 91 | +image::anypoint-code-builder-view.png["Anypoint Code Builder icon highlighted in the activity bar"] |
| 92 | +. From *Create*, click *Design an API*: |
| 93 | ++ |
| 94 | +image::design-api-1.png["*Design an API* link highlighted in the *Create* section"] |
| 95 | + |
| 96 | +. Complete the *API Specification* form: |
| 97 | ++ |
| 98 | +[%header,cols="20a,60a"] |
| 99 | +|=== |
| 100 | +| Field Name | Field Value |
| 101 | + |
| 102 | +| *Project Name* | Unique name for your project. |
| 103 | + |
| 104 | +This name is used as the API spec title in Exchange, as the name of the spec file, and as the name of the project's root directory. |
| 105 | + |
| 106 | +include::partial$acb-reusable-steps.adoc[tags=no-project-name-reuse] |
| 107 | +| *Project Location* | Your home directory or another directory you create. |
| 108 | + |
| 109 | +See xref:start-add-folders.adoc[]. |
| 110 | + |
| 111 | +include::partial$acb-reusable-steps.adoc[tags=proj-directory-warn] |
| 112 | +| *API Type* | *REST API* |
| 113 | + |
| 114 | +| *API Specification Language* | *RAML 1.0* + |
| 115 | +Anypoint Code Builder also supports *RAML 0.8* and OAS formats. For the full list, see xref:des-designing-api-specs.adoc#supported-spec-languages[Supported OAS and RAML Versions]. |
| 116 | +|=== |
| 117 | +. Click *Create Project*. |
| 118 | ++ |
| 119 | +If prompted, trust the authors of the files in the folder. |
| 120 | ++ |
| 121 | +When the project is ready for editing, the API project opens your root RAML file in the Editor view. The file name matches the project name you provided (for example, `my-inventory-api.raml`). |
| 122 | +. Continue designing your RAML spec in the Editor view. |
| 123 | ++ |
| 124 | +Use xref:start-discover-ui.adoc#auto-complete[auto-complete] (Ctrl+Space or Cmd+Space) to add resources, methods, traits, and other RAML constructs in context. |
| 125 | ++ |
| 126 | +To add reusable data types and examples from Anypoint Exchange, add fragment dependencies to the project and reference them with `!include` directives in RAML. For step-by-step procedures, see xref:des-create-api-fragments.adoc[]. |
| 127 | ++ |
| 128 | +When you want to try requests against your examples, <<review-spec-console, open the API Console>> and <<test-spec, use the mocking service>> the same way you do for OAS projects. |
| 129 | + |
| 130 | +.Optional starter RAML for a `/items` resource |
| 131 | +[%collapsible] |
| 132 | +==== |
| 133 | +[source,raml,linenums] |
| 134 | +---- |
| 135 | +#%RAML 1.0 |
| 136 | +title: Example Items API |
| 137 | +
|
| 138 | +/items: |
| 139 | + get: |
| 140 | + description: List items |
| 141 | +---- |
| 142 | +==== |
| 143 | + |
82 | 144 | [[import-spec]] |
83 | 145 | == Import an API Specification from MuleSoft VCS |
84 | 146 |
|
@@ -285,9 +347,9 @@ If you created an OAS 3.0 (YAML) project, you can replace the initial spec with |
285 | 347 |
|
286 | 348 |
|
287 | 349 | * xref:start-acb.adoc[] |
288 | | -* xref:tutorials.adoc[] |
| 350 | +* xref:tutorials.adoc#modular-learning-paths[Take Your API Specification from Design Through Deployment] |
289 | 351 | * xref:access-management::business-groups.adoc[] |
290 | 352 | * xref:start-discover-ui.adoc#use-autocomplete[Use Auto-Complete in the Editors] |
291 | | -* xref:tut-af-design-am-flights-api.adoc[] Tutorial |
| 353 | +* xref:des-create-api-fragments.adoc[] |
292 | 354 | * xref:des-delete-api-projects.adoc[] |
293 | 355 | * xref:start-workspaces.adoc[] |
0 commit comments