diff --git a/modules/ROOT/nav.adoc b/modules/ROOT/nav.adoc index c0f703175..31355c51a 100644 --- a/modules/ROOT/nav.adoc +++ b/modules/ROOT/nav.adoc @@ -17,20 +17,6 @@ // TUTORIALS * xref:tutorials.adoc[] -** xref:tut-af-amflights-overview.adoc[] -*** xref:tut-af-design-am-flights-api.adoc[] -**** xref:tut-af-design-api-add-request-response-details.adoc[] -**** xref:tut-af-design-api-test-specification.adoc[] -**** xref:tut-af-design-api-publish-api-spec-to-exchange.adoc[] - -*** xref:tut-af-integrate-am-flights.adoc[] -**** xref:tut-af-integrate-connect-to-a-db.adoc[] -**** xref:tut-af-integrate-use-dataweave.adoc[] - -*** xref:tut-af-implement-am-flights-api.adoc[] -*** xref:tut-af-debug-am-flights.adoc[] -*** xref:tut-af-deploy-am-flights.adoc[] - ** xref:tut-local-api-specification.adoc[] ** xref:tut-graphql-implement-api.adoc[] @@ -85,8 +71,8 @@ ** xref:int-configure-components.adoc[] *** xref:int-configure-components-add.adoc[] *** xref:int-configure-dw-expressions.adoc[] -*** xref:int-configure-components-check-connection.adoc[] *** xref:int-configure-components-import-connector-exchange.adoc[] +*** xref:int-configure-components-check-connection.adoc[] *** xref:int-configure-components-open-from-xml.adoc[] ** xref:int-create-secure-configs.adoc[] ** xref:int-trigger-flows.adoc[] diff --git a/modules/ROOT/pages/des-create-api-fragments.adoc b/modules/ROOT/pages/des-create-api-fragments.adoc index a0686b4df..cbd258b0a 100644 --- a/modules/ROOT/pages/des-create-api-fragments.adoc +++ b/modules/ROOT/pages/des-create-api-fragments.adoc @@ -1,6 +1,6 @@ = Creating and Using API Spec Fragments :page-deployment-options: cloud-ide, desktop-ide -:page-aliases: des-add-examples-to-specs.adoc +:page-aliases: des-add-examples-to-specs.adoc, add-request-response-details.adoc, tut-af-design-api-add-request-response-details.adoc include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] @@ -41,7 +41,7 @@ Before adding fragments: * xref:start-acb.adoc[Set up and access the web or desktop IDE]. * Understand the basics of designing API specifications. + -See the xref:tutorials.adoc[] for details. +To see where adding fragments fits in the journey from API design through deployment, see xref:tutorials.adoc#modular-learning-paths[Take Your API Specification from Design Through Deployment in Mule]. * Have some familiarity with xref:access-management::business-groups.adoc[business groups]. + When you publish your API fragment to Exchange from Anypoint Code Builder, the IDE requests the name of the business group. See xref:access-management::business-groups.adoc[]. @@ -504,5 +504,6 @@ channels: == See Also * xref:des-publish-api-spec-to-exchange.adoc[] -* xref:tut-af-design-api-add-request-response-details.adoc[] Tutorial +* xref:des-create-api-specs.adoc#test-spec[Test Your API Spec Using the Mocking Service] +* xref:des-create-api-fragments.adoc#add-fragment-to-project[Add the API fragment from Exchange] * xref:des-delete-api-projects.adoc[] diff --git a/modules/ROOT/pages/des-create-api-specs.adoc b/modules/ROOT/pages/des-create-api-specs.adoc index bc465be3d..69952f87a 100644 --- a/modules/ROOT/pages/des-create-api-specs.adoc +++ b/modules/ROOT/pages/des-create-api-specs.adoc @@ -1,6 +1,6 @@ = Creating and Importing API Specifications :page-deployment-options: cloud-ide, desktop-ide -:page-aliases: des-test-api-specs.adoc +: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 include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] @@ -8,14 +8,15 @@ Use Anypoint Code Builder to create, import, and test API specs before publishin . Create a API spec project in Anypoint Code Builder from the IDE or by importing the spec from MuleSoft VCS: -* <> +* <> (example uses OAS 3.0 (YAML)) +* <> * <> . <>. . <>. . <>. -Use the <> API spec to explore the functionality of Anypoint Code Builder. +Use the <> API spec to explore the functionality of Anypoint Code Builder with OAS, or see <> for a RAML-first project. == Before You Begin @@ -23,7 +24,7 @@ Use the <> API spec to explore the functiona * xref:start-acb.adoc[Set up and access the web or desktop IDE]. * Understand the basics of designing API specs. + -See the xref:tutorials.adoc[] for details. +See xref:tutorials.adoc#modular-learning-paths[Take Your API Specification from Design Through Deployment] for a suggested order of topics. * Have some familiarity with xref:access-management::business-groups.adoc[business groups]. + 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] + 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. +[[create-raml-rest-api-spec]] +== Create a REST API Specification Using RAML 1.0 + +To create a REST API specification project that uses RAML 1.0: + +// Open the ACB IDE +include::partial$acb-reusable-steps.adoc[tags="open-ide"] ++ +image::anypoint-code-builder-view.png["Anypoint Code Builder icon highlighted in the activity bar"] +. From *Create*, click *Design an API*: ++ +image::design-api-1.png["*Design an API* link highlighted in the *Create* section"] + +. Complete the *API Specification* form: ++ +[%header,cols="20a,60a"] +|=== +| Field Name | Field Value + +| *Project Name* | Unique name for your project. + +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. + +include::partial$acb-reusable-steps.adoc[tags=no-project-name-reuse] +| *Project Location* | Your home directory or another directory you create. + +See xref:start-add-folders.adoc[]. + +include::partial$acb-reusable-steps.adoc[tags=proj-directory-warn] +| *API Type* | *REST API* + +| *API Specification Language* | *RAML 1.0* + +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]. +|=== +. Click *Create Project*. ++ +If prompted, trust the authors of the files in the folder. ++ +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`). +. Continue designing your RAML spec in the Editor view. ++ +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. ++ +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[]. ++ +When you want to try requests against your examples, <> and <> the same way you do for OAS projects. + +.Optional starter RAML for a `/items` resource +[%collapsible] +==== +[source,raml,linenums] +---- +#%RAML 1.0 +title: Example Items API + +/items: + get: + description: List items +---- +==== + [[import-spec]] == Import an API Specification from MuleSoft VCS @@ -285,9 +347,9 @@ If you created an OAS 3.0 (YAML) project, you can replace the initial spec with * xref:start-acb.adoc[] -* xref:tutorials.adoc[] +* xref:tutorials.adoc#modular-learning-paths[Take Your API Specification from Design Through Deployment] * xref:access-management::business-groups.adoc[] * xref:start-discover-ui.adoc#use-autocomplete[Use Auto-Complete in the Editors] -* xref:tut-af-design-am-flights-api.adoc[] Tutorial +* xref:des-create-api-fragments.adoc[] * xref:des-delete-api-projects.adoc[] * xref:start-workspaces.adoc[] \ No newline at end of file diff --git a/modules/ROOT/pages/des-publish-api-spec-to-exchange.adoc b/modules/ROOT/pages/des-publish-api-spec-to-exchange.adoc index 8047f861e..29cdbc83e 100644 --- a/modules/ROOT/pages/des-publish-api-spec-to-exchange.adoc +++ b/modules/ROOT/pages/des-publish-api-spec-to-exchange.adoc @@ -1,5 +1,6 @@ = Publishing API Projects to Exchange :page-deployment-options: cloud-ide, desktop-ide +:page-aliases: publish-api-spec-to-exchange.adoc, tut-af-design-api-publish-api-spec-to-exchange.adoc include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] diff --git a/modules/ROOT/pages/imp-implement-api-specs.adoc b/modules/ROOT/pages/imp-implement-api-specs.adoc index ad5d6362e..b700dc07a 100644 --- a/modules/ROOT/pages/imp-implement-api-specs.adoc +++ b/modules/ROOT/pages/imp-implement-api-specs.adoc @@ -1,5 +1,6 @@ = Implementing OAS, RAML, AsyncAPI, and GraphQL APIs :page-deployment-options: cloud-ide, desktop-ide +:page-aliases: ui-tut-implement.adoc, implement-api-specification.adoc, implement-an-api-specification.adoc, tut-af-implement-am-flights-api.adoc include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] diff --git a/modules/ROOT/pages/imp-implementing-apis.adoc b/modules/ROOT/pages/imp-implementing-apis.adoc index c0dff277a..9fdeb3b16 100644 --- a/modules/ROOT/pages/imp-implementing-apis.adoc +++ b/modules/ROOT/pages/imp-implementing-apis.adoc @@ -20,7 +20,7 @@ The methods for implementing APIs using Anypoint Code Builder are: // TODO: Include a link to gRPC Connector docs. * xref:imp-implement-local-apis.adoc[Scaffold an API] into an implementation project without first publishing it to Anypoint Exchange, enabling iterative design and implementation. -After scaffolding an API specification into an interface, you are ready to develop, test, and deploy your Mule app as described in xref:int-developing-integrations.adoc[]. To understand how an integration project can implement an API specification, see the tutorial xref:tut-af-implement-am-flights-api.adoc[]. +After scaffolding an API specification into an interface, you are ready to develop, test, and deploy your Mule app as described in xref:int-developing-integrations.adoc[]. For the ordered topics from API design through deployment, see xref:tutorials.adoc#modular-learning-paths[Take Your API Specification from Design Through Deployment]. == Source Control for Implementation Projects diff --git a/modules/ROOT/pages/int-configure-components.adoc b/modules/ROOT/pages/int-configure-components.adoc index 990c8b8fc..7f23bac66 100644 --- a/modules/ROOT/pages/int-configure-components.adoc +++ b/modules/ROOT/pages/int-configure-components.adoc @@ -1,6 +1,6 @@ = Configuring Components :page-deployment-options: cloud-ide, desktop-ide -:page-aliases: int-work-with-code-snippets.adoc, work-with-code-snippets.adoc, create-xml-snippets.adoc +:page-aliases: int-work-with-code-snippets.adoc, work-with-code-snippets.adoc, create-xml-snippets.adoc, connect-to-a-db.adoc, tut-af-integrate-connect-to-a-db.adoc :open-config-xml: In the Explorer, open the configuration XML file for your project: include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] diff --git a/modules/ROOT/pages/int-configure-dw-expressions.adoc b/modules/ROOT/pages/int-configure-dw-expressions.adoc index 34eacad5d..07f141b95 100644 --- a/modules/ROOT/pages/int-configure-dw-expressions.adoc +++ b/modules/ROOT/pages/int-configure-dw-expressions.adoc @@ -1,7 +1,11 @@ = Using DataWeave Expressions and Transformations in Anypoint Code Builder -:page-aliases: int-use-dw-to-transform-data.adoc, int-address-dw-errors.adoc, int-import-dw-libraries.adoc +:page-aliases: int-use-dw-to-transform-data.adoc, int-address-dw-errors.adoc, int-import-dw-libraries.adoc, use-dataweave.adoc, tut-af-integrate-use-dataweave.adoc -DataWeave is the MuleSoft programming language for data transformation and for defining expressions. Use DataWeave to process Mule event data, such as `payload`, `attributes`, and `vars`, in connector operations and other components. Develop DataWeave expressions and transformations in your Mule applications using the *Expression Field*, *Expression Builder*, or *Transformation Builder*, or by editing the configuration XML. Generate DataWeave transformations with AI help by providing input and output sample data, metadata, or both. AI-powered auto mapping provides comprehensive error feedback for GenAI actions, including authorization, metadata, and request limits, ensuring a more reliable and guided mapping experience. + + +DataWeave is the MuleSoft programming language for data transformation and for defining expressions. + +Use DataWeave to process Mule event data, such as `payload`, `attributes`, and `vars`, in connector operations and other components. Develop DataWeave expressions and transformations in your Mule applications using the *Expression Field*, *Expression Builder*, or *Transformation Builder*, or by editing the configuration XML. Generate DataWeave transformations with AI help by providing input and output sample data, metadata, or both. AI-powered auto mapping provides comprehensive error feedback for GenAI actions, including authorization, metadata, and request limits, ensuring a more reliable and guided mapping experience. image::int-dw-transform-ui.png["A configuration panel showing three numbered callouts: 1) fx button for Expression Field, 2) Expression Builder button, and 3) Transformation Builder button"] @@ -589,4 +593,6 @@ When complete, Anypoint Code Builder shows a message that the dependency was suc * xref:int-debug-mule-apps.adoc[] * xref:troubleshoot-dataweave.adoc[] * xref:int-create-integrations.adoc#add-components[Add a Component to Your Project] +* xref:imp-implement-api-specs.adoc[] +* xref:des-publish-api-spec-to-exchange.adoc#locate-api[Locate Your API in Exchange] * xref:acb-reference.adoc[] diff --git a/modules/ROOT/pages/int-create-integrations.adoc b/modules/ROOT/pages/int-create-integrations.adoc index 35be09a39..b604b03ba 100644 --- a/modules/ROOT/pages/int-create-integrations.adoc +++ b/modules/ROOT/pages/int-create-integrations.adoc @@ -1,6 +1,6 @@ = Creating Integrations :page-deployment-options: cloud-ide, desktop-ide -:page-aliases: int-create-basic-integrations.adoc +:page-aliases: int-create-basic-integrations.adoc, ui-tut-integrate.adoc, create-basic-integration.adoc, develop-integration.adoc, tut-af-integrate-am-flights.adoc include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] diff --git a/modules/ROOT/pages/int-debug-mule-apps.adoc b/modules/ROOT/pages/int-debug-mule-apps.adoc index 84d33f32f..0ca30ffb0 100644 --- a/modules/ROOT/pages/int-debug-mule-apps.adoc +++ b/modules/ROOT/pages/int-debug-mule-apps.adoc @@ -1,6 +1,6 @@ = Debugging Mule Applications :page-deployment-options: cloud-ide, desktop-ide -:page-aliases: debug-add-breakpoint.adoc, debug-add-components.adoc, debug-run-debug-sessions.adoc, debug-a-mule-application.adoc, debugging-mule-apps.adoc +:page-aliases: debug-add-breakpoint.adoc, debug-add-components.adoc, debug-add-logger-set-variables.adoc, debug-run-debug-sessions.adoc, debug-a-mule-application.adoc, debugging-mule-apps.adoc, tut-af-debug-am-flights.adoc include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] @@ -56,7 +56,6 @@ Keyboard shortcut: Cmd+Shift+d (Mac) or Ctrl+Shift+d (Windows) Open the *Debug Console* tab in the panel area to <> while execution is paused. See <>. - [[add-breakpoint]] == Add a Breakpoint diff --git a/modules/ROOT/pages/int-deploy-mule-apps.adoc b/modules/ROOT/pages/int-deploy-mule-apps.adoc index 7ca715e9c..5e84f48a6 100644 --- a/modules/ROOT/pages/int-deploy-mule-apps.adoc +++ b/modules/ROOT/pages/int-deploy-mule-apps.adoc @@ -1,6 +1,6 @@ = Deploying Mule Apps to CloudHub and CloudHub 2.0 :page-deployment-options: cloud-ide, desktop-ide -:page-aliases: deploy-a-mule-application-to-cloudhub.adoc +:page-aliases: deploy-a-mule-application-to-cloudhub.adoc, tut-af-deploy-am-flights.adoc include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] diff --git a/modules/ROOT/pages/int-trigger-flows.adoc b/modules/ROOT/pages/int-trigger-flows.adoc index e4b2fa8f1..0be710cbc 100644 --- a/modules/ROOT/pages/int-trigger-flows.adoc +++ b/modules/ROOT/pages/int-trigger-flows.adoc @@ -16,7 +16,7 @@ A *Scheduler*, a *Flow Ref*, or any connector trigger or message source can init * Complete xref:start-acb.adoc[] for your IDE. * Make sure an integration or implementation project with an HTTP Listener (``) is available from the cloud or desktop IDE. + -To create a project, see xref:int-create-integrations.adoc[] or xref:imp-implementing-apis.adoc[], or follow the procedures in the tutorial xref:tut-af-amflights-overview.adoc[]. +To create a project, see xref:int-create-integrations.adoc[] or xref:imp-implementing-apis.adoc[], or follow xref:tutorials.adoc#modular-learning-paths[Take Your API Specification from Design Through Deployment]. [[trigger-urls]] == URLs for Triggering a Flow from an HTTP Listener diff --git a/modules/ROOT/pages/start-workspaces.adoc b/modules/ROOT/pages/start-workspaces.adoc index 8d7c3727a..f23e536b9 100644 --- a/modules/ROOT/pages/start-workspaces.adoc +++ b/modules/ROOT/pages/start-workspaces.adoc @@ -81,7 +81,7 @@ image::imp-local-api-open-workspace.png["A multi-root workspace in Explorer view You can ask MuleSoft Vibes to switch workspaces using natural language prompts, such as: -* "Open my American Flights workspace" +* "Open my Orders API workspace" * "Switch to the `` workspace" [[close-workspace]] diff --git a/modules/ROOT/pages/tut-af-amflights-overview.adoc b/modules/ROOT/pages/tut-af-amflights-overview.adoc deleted file mode 100644 index 1641319cb..000000000 --- a/modules/ROOT/pages/tut-af-amflights-overview.adoc +++ /dev/null @@ -1,51 +0,0 @@ -= Develop the American Flights App -:page-deployment-options: cloud-ide, desktop-ide -:page-pagination: next - -Use Anypoint Code Builder to create and implement an API specification that returns flight information from a MySQL database. - -. xref:tut-af-design-am-flights-api.adoc[]: - -* Start the American Flights API specification. -* Add a resource and methods. -* Add query parameters and nested resources. -* Add fragments and examples: -** Add API fragments from Exchange for a data type and examples to the American Flights API specification. -** Create your own examples for the specification. -** Add a custom message for a response. -. xref:tut-af-design-api-add-request-response-details.adoc[] -+ -Use the Mocking Service in the API Console to check the request and responses that you configured for American Flights API. -. xref:tut-af-design-api-publish-api-spec-to-exchange.adoc[]: -+ -Publish the American Flights API specification to Exchange so that other team members can find and implement it. -//develop example: -. Create an integration application for the American Flights example: - -.. xref:tut-af-integrate-am-flights.adoc[]: -+ -Start by creating a basic integration for the American Flights example. This integration provides some of the logic for processing requests from the American Flights API. -.. xref:tut-af-integrate-connect-to-a-db.adoc[]: - -* Import the Anypoint Connector for Database (Database Connector) from Exchange. -* Configure a database operation to connect to an external database from your Mule flow. -.. xref:tut-af-integrate-use-dataweave.adoc[]: -+ -Use DataWeave to transform and match flight data to your API specification. -//implement example: -. xref:tut-af-implement-am-flights-api.adoc[]: - -* Import your American Flights API specification from Anypoint Exchange. -* Scaffold the specification into the American Flights project that you are developing. -* Add logic to implement an endpoint in the API. -//debug example: -. xref:tut-af-debug-am-flights.adoc[]: - -* Prepare to debug your Mule application by adding Logger and Set Variable components to better understand the behavior of your flows. -* Set up breakpoints to stop your Mule application at specific points during a debug session. -* Run a debug session, and inspect the message and variables at different points during your application's execution. -//deploy example: -. xref:tut-af-deploy-am-flights.adoc[]: - -* Deploy your American Flights application to CloudHub. -* Enable your team to send requests to your API and return flight information from a database. diff --git a/modules/ROOT/pages/tut-af-debug-am-flights.adoc b/modules/ROOT/pages/tut-af-debug-am-flights.adoc deleted file mode 100644 index 0fb01716b..000000000 --- a/modules/ROOT/pages/tut-af-debug-am-flights.adoc +++ /dev/null @@ -1,347 +0,0 @@ -= Debugging the American Flights App -:page-deployment-options: cloud-ide, desktop-ide -:page-aliases: debug-add-logger-set-variables.adoc -:page-pagination: - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - - -Debug your American Flights interface and implementation. - -== Before You Begin - -Complete these procedures: - -. xref:tut-af-design-am-flights-api.adoc[] -. xref:tut-af-integrate-am-flights.adoc[] -. xref:tut-af-implement-am-flights-api.adoc[] - -== Add Components - -To facilitate debugging, add Set Variable and Logger components to your American Flights implementation: - -. Open the implementation file (`implementation.xml`). -. After the Database Select operation (``) named *Query Flights*, add a Set Variable component: -+ -In the configuration XML, provide this `` configuration: -+ -[source,xml] ----- - ----- -. After the Transform component (``), add a Logger component with this configuration: -+ -[source,xml] ----- - ----- -+ -.Click for the complete implementation XML example. -[%collapsible] -==== -[source,xml] --- - - - - - - - - - //<1> - - - - - { - ID: payload01.ID, - code: (payload01.code1 default "") ++ (payload01.code2 default ""), - price: payload01.price default 0, - departureDate: payload01.takeOffDate as String default "", - origin: payload01.fromAirport default "", - destination: payload01.toAirport default "", - emptySeats: payload01.seatsAvailable default 0, - plane: { - "type": payload01.planeType default "", - totalSeats: payload01.totalSeats default 0 - } - } - ]]> - - - - - //<2> - - --- -[calloutlist] -.. Set Variable component -.. Logger component -==== -. Proceed to <>. -+ -Learn to set up breakpoints to pause execution of your app. - -[[add-breakpoint]] -== Add Breakpoints - -Add breakpoints to your American Flights project: - -. Open the _interface_ (`interface.xml`) for your American Flights project. -. Select the *Run and Debug* icon in the activity bar: -+ -image::run-and-debug.png["An interface XML file open in the code editor, with the Run and Debug icon highlighted"] -. In the interface file (`interface.xml`), add a breakpoint to the line that contains the `` component: -+ -image::add-breakpoint.png["An interface XML file open in the code editor, with a breakpoint enabled"] -+ -Alternatively, use F9 to add a breakpoint to the line. -. Open the implementation file (`implementation.xml`) for your American Flights project, and add breakpoints to the `` and `` components. -+ -. Notice that all the breakpoints are now listed in the *Breakpoints* panel: -+ -image::breakpoints-panel.png["A menu panel displaying three enabled breakpoints"] -. Proceed to <>. -+ -Run a debugging session, and inspect the message and variables at different points during your app's execution. - -[[debug]] -== Start a Debugging Session - -. From the *Run and Debug* menu, click *Debug Mule Application*: -+ -image::start-debugging.png["The Run and Debug and the Debug Mule Applications icons both highlighted"] -+ -The IDE packages the app and opens a new terminal that deploys the app to the embedded Mule runtime engine: -+ -image::packaged-and-running-terminals.png["A terminal window displaying application status as deployed"] -. Proceed to <>. - -[[test]] -== Test Your American Flights App - -After starting your debugging session: - -//open terminal -include::anypoint-code-builder::partial$acb-reusable-steps.adoc[tag="open-terminal"] -. In the terminal, use a `curl` command to make a GET request to the listener in the _interface_ (`interface.xml`) instead of the implementation: -+ -[source,URI] ----- -curl http://localhost:8081/api/flights ----- -+ -Notice the `_/api/flights_` in the URI for the listener in the interface. For more information about this step, see xref:int-trigger-flows.adoc#trigger-flow[Trigger a flow]. -. In your American Flights project, notice that the execution of the app stops at your first breakpoint: -+ -image::debug-stop-at-flow-ref.png["Stopping the flow at a breakpoint"] -+ -The breakpoint is located in your interface file (`interface.xml`). -. In your debug toolbar, click the *Step Over* button to continue execution to the next breakpoint, at the `` element in `implementation.xml`. -. In the *Run and Debug* sidebar, notice that the *Variables* panel provides information about the Mule event at the breakpoint: -+ -image::debugger-stop-db-select.png["Breakpoint in the configuration XML file where execution stops"] -. Click the *Step Over* button on your debug toolbar to continue execution to your next breakpoint, at the `` element. -. In the *Variables* panel, navigate to *Mule Message* > *Payload*, and notice that the database response is an array of flight data: -+ -image::debugger-stop-set-variable.png["Array of flight data in the payload"] -. Proceed to <>. - -[[watch]] -== Add a Watch Expression - -. From the *Run and Debug* sidebar, open the *Watch* panel. -. Click the *+* icon in the panel, and add the expression `payload.^mediaType`: -+ -image::debug-add-expression.png["A debug window displaying application variables, with the Add Expression button highlighted"] -. Click the *Step Over* button until your execution moves to the Transform Message component (``). -. Notice that the payload is `application/java`: -+ -image:tut-debug-mediatype-java.png["The Watch panel displaying a payload type of 'application/java'"] -. Continue clicking the *Step Over* button until you reach the Logger component (``). -. Notice that your payload transforms to `application/json`: -+ -image::tut-debug-mediatype-json.png["The Watch panel displaying a payload type of 'application/json'"] -. Click the *Continue* button in the debug toolbar, and notice that the app returns the response from the database to your REST client or browser. -+ -.Click for the complete implementation XML example. -[%collapsible] -==== -[source,JSON] --- -[ - { - "ID": 1, - "code": "rree0001", - "price": 541, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "LAX", - "emptySeats": 0, - "plane": { - "type": "Boeing 787", - "totalSeats": 200 - } - }, - { - "ID": 2, - "code": "eefd0123", - "price": 300, - "departureDate": "2016-01-25T00:00:00", - "origin": "MUA", - "destination": "CLE", - "emptySeats": 7, - "plane": { - "type": "Boeing 747", - "totalSeats": 345 - } - }, - { - "ID": 3, - "code": "ffee0192", - "price": 300, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "LAX", - "emptySeats": 0, - "plane": { - "type": "Boeing 777", - "totalSeats": 300 - } - }, - { - "ID": 4, - "code": "rree1000", - "price": 200, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "CLE", - "emptySeats": 5, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - }, - { - "ID": 5, - "code": "rree1093", - "price": 142, - "departureDate": "2016-02-11T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 1, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - }, - { - "ID": 6, - "code": "ffee1112", - "price": 954, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "CLE", - "emptySeats": 100, - "plane": { - "type": "Boeing 787", - "totalSeats": 200 - } - }, - { - "ID": 7, - "code": "eefd1994", - "price": 676, - "departureDate": "2016-01-01T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 0, - "plane": { - "type": "Boeing 777", - "totalSeats": 300 - } - }, - { - "ID": 8, - "code": "ffee2000", - "price": 300, - "departureDate": "2016-02-20T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 30, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - }, - { - "ID": 9, - "code": "eefd3000", - "price": 900, - "departureDate": "2016-02-01T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 0, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - }, - { - "ID": 10, - "code": "eefd4511", - "price": 900, - "departureDate": "2016-01-15T00:00:00", - "origin": "MUA", - "destination": "LAX", - "emptySeats": 100, - "plane": { - "type": "Boeing 777", - "totalSeats": 300 - } - }, - { - "ID": 11, - "code": "rree4567", - "price": 456, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 100, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - } -] --- -==== -. Proceed to <>. - -[[stop]] -== Stop the Debugging Session - -To stop your debugging session: - -. Click the *Stop* button on your debug toolbar: -+ -image::debugger-stop.png["Stopping a debugging session from the debug toolbar"] -. Proceed to xref:tut-af-deploy-am-flights.adoc[]. - diff --git a/modules/ROOT/pages/tut-af-deploy-am-flights.adoc b/modules/ROOT/pages/tut-af-deploy-am-flights.adoc deleted file mode 100644 index 562458858..000000000 --- a/modules/ROOT/pages/tut-af-deploy-am-flights.adoc +++ /dev/null @@ -1,74 +0,0 @@ -= Deploying the American Flights App -:page-deployment-options: cloud-ide, desktop-ide -:page-pagination: prev - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - - -Deploy the American Flights application to CloudHub. After deploying to CloudHub, manage your application through Anypoint Runtime Manager. - -Anypoint Code Builder deploys Mule applications to the non-production *Sandbox* environment in CloudHub. - -== Before You Begin - -Complete these procedures: - -. xref:tut-af-design-am-flights-api.adoc[] -. xref:tut-af-integrate-am-flights.adoc[] -. xref:tut-af-implement-am-flights-api.adoc[] -. xref:tut-af-debug-am-flights.adoc[] -. Log in to Anypoint Platform from the IDE. If you do not log in, the IDE prompts you to log in when an operation that you perform requires authentication. You can follow the prompts in the UI to complete the login process when prompted. - - -== Deploy an Application to CloudHub - -. Open your project in Anypoint Code Builder. -. Click the image:icon-deploy.png["",20,20] (*Deploy to CloudHub*) icon when your configuration XML file is open, for example: -+ -image::deploy-to-cloudhub-icon-with-detail.png["Deploy to CloudHub "rocket" icon] -+ -Alternatively, open the Command Palette by pressing Cmd+Shift+p (Mac) or Ctrl+Shift+p (Windows), and provide this command: -+ -[source,command] ----- -MuleSoft: Deploy to CloudHub ----- -+ -image::deploy-to-cloudhub.png["MuleSoft: Deploy to CloudHub command highlighted"] -. If prompted, sign in to Anypoint Platform. -. When prompted, click *Deploy*. -+ -Anypoint Code Builder creates and opens a deployment file (`deploy.json`) for your review, for example: -+ -[source,json] --- -{ - "runtime": "4.4.0", - "workerSize": 0.1, - "applicationName": "american-ws-anypoint-code-builder" - "workers": 1, - "autoStart": true -} --- -+ -* The `applicationName` property defines part of the URL for accessing your application on CloudHub. -* The name must be unique across all applications deployed to your business group in CloudHub. -* The `runtime` version is the Mule runtime version you select when creating the integration. -+ -include::partial$acb-runtime-java.adoc[tags="runtime-version-note"] - -. After reviewing the deployment configuration, click *Deploy* to deploy the application to CloudHub: -+ -image::deploy-config-created.png["Deployment configuration file created pop-up message"] -. Select the *Sandbox* environment: -+ -image::select-deployment-environment.png["Design and Sandbox environment options highlighted"] -+ -Other environments are not supported. -+ -Anypoint Code Builder packages and deploys the application to CloudHub. -. After deployment completes, select *Open in Runtime Manager*. -. Select your application from the list applications. -. Check the domain name for your application and, optionally, test the application. -+ -For example, the name of the American Flights example on the EU cloud is similar to `+american-ws-anypoint-code-builder.eu-s1.cloudhub.io+`. To start the example, open your REST client or browser, and make a GET request to the URI, for example: `+http://american-ws-anypoint-code-builder.eu-s1.cloudhub.io/api/flights+` diff --git a/modules/ROOT/pages/tut-af-design-am-flights-api.adoc b/modules/ROOT/pages/tut-af-design-am-flights-api.adoc deleted file mode 100644 index 634fd779c..000000000 --- a/modules/ROOT/pages/tut-af-design-am-flights-api.adoc +++ /dev/null @@ -1,138 +0,0 @@ -= Designing the American Flights API Spec -//ACB UI links to ui-tut-design.adoc (DO NOT REMOVE WITHOUT UX/DEV ALIGNMENT) -:page-deployment-options: cloud-ide, desktop-ide -:page-aliases: ui-tut-design.adoc, tut-af-design-api-specification-from-scratch.adoc, design-api-specification.adoc -:page-pagination: - - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - - -Use Anypoint Code Builder to create a REST API specification example called American Flights API. In this API, reuse API fragments from Anypoint Exchange, create data types and response examples, test your API using API Console, and publish the API as an asset to Exchange. - -After completing all API specification tasks, xref:tut-af-implement-am-flights-api.adoc[implement] the specification within an xref:tut-af-integrate-am-flights.adoc[integration]. For more information, see xref:tut-af-amflights-overview.adoc[]. - -[[prereqs]] -== Before You Begin - -* Set up and access the web or desktop IDE. -+ -See xref:start-acb.adoc[] for guidance. -* Have some familiarity with xref:access-management::business-groups.adoc[business groups]. -+ -API specifications belong to a business group. - -[[start-spec]] -== Start American Flights API - -Start creating the American Flights API specification: - -// Open the ACB IDE -include::partial$acb-reusable-steps.adoc[tags="open-ide"] -+ -image::acb-mulesoft-in-activity-bar.png["MuleSoft icon in the VS Code Activity Bar"] -. From *Create*, click *Design an API*: -+ -image::design-api-1.png["Link to Design an API in the MuleSoft panel"] -+ -If you receive the error *Mule DX API Component was not installed*, wait for Mule runtime engine to load and for background processes to complete. To monitor background processes, see xref:troubleshoot-loading-errors.adoc[]. -. Configure your API specification project using these values: -+ -[%header,cols="1a,1a"] -|=== -| Field Name | Field Value - -| *Project Name* | *American Flights API* + - Alternatively, provide a similar name of your choice. The name must be unique. The name of the project and specification file is based on the name you provide. -| *Project Location* | Your home directory or another directory you create (see xref:start-add-folders.adoc[]). -| *API Type* | *REST API* + -Anypoint Code Builder supports the REST API type for design. -| *API Specification Language* | *RAML 1.0* + -Anypoint Code Builder supports OAS (JSON), OAS (YAML), and RAML. -|=== -. Select *Create Project* to generate the American Flights API project file: `american-flights-api.raml`. -+ -The file name is based on the name you provide for the project: -+ -image::acb-api-project.png["Project for American Airlines API"] -. Proceed to <>. - -[[add-flight-resource]] -== Add a RAML Resource and Methods - -In American Flights API, start configuring the specification, and try its *GET* method from the API Console. - -//TODO: CREATE AN INCLUDE FOR THIS COMMON STEP (make description more generic for multiple) -. Before starting the configuration, open the *Output* panel to the *Mule DX Server* to track the progress of internal processing. -+ -To open the panel: - -.. Press Cmd+Shift+u (Mac) or Ctrl+Shift+u (Windows) to open the Output panel. -.. Select *Mule DX Server* from the drop-down menu in the panel. -+ -For more guidance, see xref:start-open-output-panel.adoc[]. -. In `american-flights-api.raml`, paste this RAML code for the `/flights` endpoint and `get` method into the file: -+ -[source,raml,linenums] --- -#%RAML 1.0 -title: American Flights API - -/flights: - get: --- -. On the next line directly under `get`, press Ctrl+Space to display all the available options, and select a `post` method: -+ -[source,RAML] ----- -#%RAML 1.0 -title: American Flights API - -/flights: - get: - post: ----- -. Click the API Console icon to display your specification in the console: -+ -image::acb-api-console.png["A specification with get and post methods"] -+ -.. Monitor *Mule DX Server* in the *Output* panel while the API Console loads. -.. Click your specification file in the editor to display endpoints for the specification file in API Console. -.. Wait for the endpoint icons to render in API Console. -+ -Endpoint and methods in the API Console: -+ -//NOTE internal: image modified to have heading "Documentation" -image::get-post-methods-api-console.png["GET and POST methods highlighted in *API Console*"] -. Proceed to <>. - -[[add-query-params-nested-resources]] -== Add Query Parameters and Nested Resources - -Add a nested resource (`/{ID}:`) to use for getting a flight based on its destination, and specify optional query parameters for the destinations (`queryParameters:`) as a set of `enum` values. - -. Replace your RAML content with this specification: -+ -[source,raml,linenums] --- -#%RAML 1.0 -title: American Flights API - -/flights: - get: - queryParameters: - destination: - required: false - enum: - - SFO - - LAX - - CLE - post: - - /{ID}: - get: --- -. View the nested resource in the API Console: -+ -image::sub-methods-api-console.png["API Console with nested resource"] -. Proceed to xref:tut-af-design-api-add-request-response-details.adoc[]. diff --git a/modules/ROOT/pages/tut-af-design-api-add-request-response-details.adoc b/modules/ROOT/pages/tut-af-design-api-add-request-response-details.adoc deleted file mode 100644 index 90144e219..000000000 --- a/modules/ROOT/pages/tut-af-design-api-add-request-response-details.adoc +++ /dev/null @@ -1,318 +0,0 @@ -= Adding Examples to the API Spec -:page-deployment-options: cloud-ide, desktop-ide -:page-aliases: add-request-response-details.adoc -:page-pagination: - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - - -Add API fragments from Exchange for a data type and examples to the American Flights API specification. Then create your own examples for the specification, and add a custom message for a response. - -== Before You Begin - -Complete all the procedures in xref:tut-af-design-am-flights-api.adoc[]. - -== Add Fragments from Exchange to Your Project - -Add fragments to the project directory so that you can include them in your specification. - -* *Training: American Flight Data Type* fragment for an object that corresponds to the definition of a flight -* *Training: American Flights Example* fragment for data that the API returns - -To add the fragments: - -. In Anypoint Code Builder, open your American Flights API specification, `american-flights-api.raml`. -// Pointer to Command Palette -include::partial$acb-reusable-steps.adoc[tags="open-command-palette"] -. Provide this command: -+ -[source,command] ----- -MuleSoft: Add fragment dependency from Exchange ----- -. If prompted, log in to Anypoint Platform so that you can download an asset. -. In the *Search for Asset* field, provide the name of the data type asset to add: -+ -[source,command] ----- -Training: American Flight Data Type ----- -. Select the asset from the *Assets From Exchange* menu. -. Select the latest version of the asset, such as *v1.0.1*. -+ -The IDE adds the fragment as a dependency. When the process is complete, check for the `AmericanFlightDataType.raml` asset *Project Dependencies* area of the Explorer, for example: -+ -image:tut-design-frag-in-proj-dependencies.png["Fragments from Exchange in Project Dependencies"] -+ -The dependency is also listed in the `exchange.json` file for the project, in your project directory from the Explorer. -. From the Command Palette, add another fragment: -+ -[source,command] ----- -MuleSoft: Add fragment dependency from Exchange ----- -. Provide the name of the asset to add: -+ -[source,command] ----- -Training: American Flights Example ----- -. Select the latest version of the *American Flights Example* asset. -+ -The IDE adds the fragment as a dependency to *Project Dependencies* and `exchange.json`. -. Proceed to <>. - -[[include-fragments]] -== Include the Fragments in the Specification - -Use `!include` directives to add the fragments to the specification: - -* The `AmericanFlight` data type is defined in `AmericanFlightDataType.raml`. -* The `AmericanFlightsExample.raml` example is for a `200` response to the `get` request. - -To include the fragments: - -. Open *american-flight-api.raml* from the project directory in Explorer. -. Replace the existing content with this: -+ -[source,RAML] --- -#%RAML 1.0 -title: American Flights API - -types: //<1> - AmericanFlight: !include exchange_modules/68ef9520-24e9-4cf2-b2f5-620025690913/training-american-flight-data-type/1.0.1/AmericanFlightDataType.raml - -/flights: - get: - queryParameters: - destination: - required: false - enum: - - SFO - - LAX - - CLE - responses: - 200: - body: - application/json: //<2> - type: AmericanFlight[] - examples: //<3> - output: !include exchange_modules/68ef9520-24e9-4cf2-b2f5-620025690913/training-american-flights-example/1.0.1/AmericanFlightsExample.raml - - post: - - /{ID}: - get: --- -[calloutlist] -.. Uses `!include` to add the `AmericanFlight` object from `AmericanFlightDataType.raml` as a data type -+ -Note that you can use built-in functionality to insert the `!include` directive and file path from the specification file, for example: -+ -[loweralpha] -... After typing `AmericanFlight: ` (with a space at the end), click Ctrl+Spacebar, start typing `!include`, and select `!include` from the drop-down menu in the RAML file, for example: -+ -image::tut-api-include-directive.png["Include directive in RAML drop-down menu"] -... Follow the same process to add the example, selecting `exchange_modules` directory and progressing step-by-step to `AmericanFlightsDataType.raml`, for example: -+ -image::tut-api-include-path.png["Included path in RAML drop-down menu"] -.. Sets the format of the body of the response to JSON (`application/json`) and configures the type of the response as an array of `AmericanFlight` objects (`AmericanFlight[]`) -.. Adds the `AmericanFlightsExample.raml` example -. Proceed to <>. - -[[post-response-example]] -== Create and Include an Example for a Get Request by Flight ID - -Create an example for the post response, and include it in the specification. - -. In the Explorer, right-click on an empty space, and create a folder named `examples`. -+ -image::add-new-folder.png[alt="New Folder option highlighted in the context menu"] -. Right-click your `examples` folder, and create a new file named `AmericanFlightExample.raml`. -+ -image::create-american-fligh-example-file.png[alt="AmericanFlightExample.raml file highlighted"] -. In the open file, add this example: -+ -[source,raml] --- -#%RAML 1.0 NamedExample -value: - ID: 1 - code: ER38sd - price: 400 - departureDate: 2017/07/26 - origin: CLE - destination: SFO - emptySeats: 0 - plane: - type: Boeing 737 - totalSeats: 150 --- -. Return to your `american-flights-api.raml` file, and create a set of elements under `/{ID}/get` for responses: -+ -[source,raml] --- -#%RAML 1.0 -title: American Flights API - -types: - AmericanFlight: !include exchange_modules/68ef9520-24e9-4cf2-b2f5-620025690913/training-american-flight-data-type/1.0.1/AmericanFlightDataType.raml - -/flights: - get: - queryParameters: - destination: - required: false - enum: - - SFO - - LAX - - CLE - responses: - 200: - body: - application/json: - type: AmericanFlight[] - post: - - /{ID}: - get: - responses: //<1> - 200: - body: //<2> - application/json: - type: AmericanFlight - examples: //<3> - output: !include examples/AmericanFlightExample.raml --- -+ -[calloutlist] -.. Adds a response with a `200` code -.. Specifies the JSON format and type (`AmericanFlight`) of the *get* request body -.. Adds your example from the `/examples` directory as the content for the body of the request -. Proceed to <>. - -[[post-example]] -== Configure an Example for the Post Method - -Define an example for the `post` request: - -. Specify that a request to the `/flights:post` method requires an object of the `AmericanFlight` type: -+ -[source,raml,linenums] --- -#%RAML 1.0 -title: American Flights API - -types: - AmericanFlight: !include exchange_modules/68ef9520-24e9-4cf2-b2f5-620025690913/training-american-flight-data-type/1.0.1/AmericanFlightDataType.raml - -/flights: - get: - queryParameters: - destination: - required: false - enum: - - SFO - - LAX - - CLE - responses: - 200: - body: - application/json: - type: AmericanFlight[] - post: - body: //<1> - application/json: - type: AmericanFlight //<2> - - /{ID}: - get: - responses: - 200: - body: - application/json: - type: AmericanFlight - examples: - output: !include examples/AmericanFlightExample.raml --- -[calloutlist] -.. Specifies a JSON-formatted body for the `post` method -.. Configures `AmericanFlight` as the type for the `post` method -. Under your `/examples` folder, create a file named `AmericanFlightNoIDExample.raml`, and copy this example to the file: -+ -[source,raml] --- -#%RAML 1.0 NamedExample -value: - code: ER38sd - price: 400 - departureDate: 2017/07/26 - origin: CLE - destination: SFO - emptySeats: 0 - plane: - type: Boeing 737 - totalSeats: 150 --- -+ -To simulate a new flight record, this example does not provide an `ID` parameter. -. In the `american-flights-api.raml` file, add the example as a response to the `post` method, and include a custom message. -+ -.Notice the `!include` directive at number 5: -[source,RAML] ----- -#%RAML 1.0 -title: American Flights API - -types: - AmericanFlight: !include exchange_modules/68ef9520-24e9-4cf2-b2f5-620025690913/training-american-flight-data-type/1.0.1/AmericanFlightDataType.raml - -/flights: - get: - queryParameters: //<1> - destination: - required: false - enum: - - SFO - - LAX - - CLE - responses: //<2> - 200: - body: - application/json: - type: AmericanFlight[] - examples: - output: !include exchange_modules/68ef9520-24e9-4cf2-b2f5-620025690913/training-american-flights-example/1.0.1/AmericanFlightsExample.raml - - post: - body: - application/json: - type: AmericanFlight - examples: //<3> - input: !include examples/AmericanFlightNoIDExample.raml - responses: - 201: - body: - application/json: //<4> - example: - message: Flight added (but not really) - - /{ID}: - get: - responses: - 200: - body: - application/json: //<5> - type: AmericanFlight - examples: - output: !include examples/AmericanFlightExample.raml ----- -[calloutlist] -.. Select a destination. -.. Return an array of `AmericanFlight` objects for that destination. -.. Post an `AmericanFlight` object from an `examples/AmericanFlightNoIDExample.raml`. -.. Provide a custom message for a response in JSON format to the `post` method -.. Add your example from `examples/AmericanFlightExample.raml` as a response to the nested `get` request -//next step: -. Proceed to xref:test-api-specification.adoc[] to test the API endpoints. diff --git a/modules/ROOT/pages/tut-af-design-api-publish-api-spec-to-exchange.adoc b/modules/ROOT/pages/tut-af-design-api-publish-api-spec-to-exchange.adoc deleted file mode 100644 index ae5155ae5..000000000 --- a/modules/ROOT/pages/tut-af-design-api-publish-api-spec-to-exchange.adoc +++ /dev/null @@ -1,75 +0,0 @@ -= Publishing the API Spec to Anypoint Exchange -:page-deployment-options: cloud-ide, desktop-ide -:page-aliases: publish-api-spec-to-exchange.adoc -:page-pagination: - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - - -Publish American Flights API specification to Exchange so that other team members can find and implement it. - -[[prereqs]] -== Before You Begin - -* If you haven't started the American Flight API specification, follow these procedures before attempting to publish: -+ -. xref:tut-af-design-am-flights-api.adoc[] -. xref:tut-af-design-api-add-request-response-details.adoc[] -. xref:tut-af-design-api-test-specification.adoc[] - -// Prereq bullet on familiarity with biz groups -include::partial$acb-reusable-steps.adoc[tags="prereq-business-groups"] - - -== Publish an API to Exchange - -To publish your API to Exchange: - -. In Anypoint Code Builder, open the specification for your American Flights API project, such as `american-flights-api.raml`. -// Pointer to Command Palette -include::partial$acb-reusable-steps.adoc[tags="open-command-palette"] -. Provide the following command: -+ -[source,command] ----- -MuleSoft: Publish API Project to Exchange ----- -+ -image::publish-to-exchange.png["MuleSoft: Publish API Project to Exchange highlighted in Command Palette"] -. If prompted, click *Allow*, and follow the prompts to sign in to Anypoint Platform. -. In *Select a Business Group*, find and select your business group for the project. -+ -For more information, see <>. -. Type a project name: *American Flights API*. -. Confirm the artifact ID: *American-Flights-API*. -. Confirm the asset version: *1.0.0*. -. Confirm the API version: *v1*. -The status bar shows the progress: -+ -image::publishing-to-exchange-dialog.png["Publishing API specification to Exchange notification highlighted"] - -. When prompted to implement the API now, select *No* to avoid scaffolding the American Flights API specification into your integration. -+ -Selecting *Yes* scaffolds the API specification into your project. Instead of scaffolding now, you will scaffold in xref:tut-af-implement-am-flights-api.adoc[]. - -== Locate Your API in Exchange - -After publishing your API specification, you can find it in Anypoint Exchange: - -. Navigate to Anypoint Platform and log in using your credentials. -+ --- -// Pointer to Platform URLs -include::partial$acb-reusable-steps.adoc[tags="platform-urls"] --- -. Navigate to Anypoint Exchange. -+ --- -// Pointer to Exchange URLs -include::partial$acb-reusable-steps.adoc[tags="exchange-urls"] --- -+ -. Notice that your API specification is listed as an asset. -+ -You can select the API, navigate through its summary, and see all the endpoints you defined in the previous tasks. -. Proceed to xref:tut-af-integrate-am-flights.adoc[] to start an integration app for American Flights. diff --git a/modules/ROOT/pages/tut-af-design-api-test-specification.adoc b/modules/ROOT/pages/tut-af-design-api-test-specification.adoc deleted file mode 100644 index f3906a1d8..000000000 --- a/modules/ROOT/pages/tut-af-design-api-test-specification.adoc +++ /dev/null @@ -1,44 +0,0 @@ -= Testing the API Spec with the Mocking Service -:page-deployment-options: cloud-ide, desktop-ide -:page-aliases: test-api-specification.adoc -:page-pagination: - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - - -Use the Mocking Service in the API Console to check the GET request and response that you configured for American Flights API in xref:tut-af-design-api-add-request-response-details.adoc[]. - -== Before You Begin - -If you haven't started the American Flight API specification, complete these procedures before attempting to test: - -. xref:tut-af-design-am-flights-api.adoc[] -. xref:tut-af-design-api-add-request-response-details.adoc[] - -== Test Your API Specification - -. In Anypoint Code Builder, open the RAML file for your American Flights API specification (`american-flights-api.raml`). -. Click the *API Console* icon in the editor toolbar: -+ -image::api-console-button.png["API Console icon highlighted in the editor toolbar"] -. In API Console, select the `get` method for the `flights/` resource: -+ -image::select-get-method.png["get method for the flights/ resource highlighted in the API Console"] -. Click *Try It*: -+ -image::select-try-it-button.png["Try it button highlighted in the API Console"] -. Select the *destination* text box inside *Query Parameters* and verify that the three values you defined in your API specification appear: -+ -image::select-query-params.png["Values highlighted in the API Console"] -. Click *Send*. -. Verify that the API Console returns the response you defined with the imported fragment (`AmericanFlightsExample.raml`): -+ -image::api-console-reponse.png["A 200 OK response highlighted in the API Console"] -+ -The logic for selecting specific destinations is not yet implemented. -+ -Optionally, review your configured response examples when querying your mocked API endpoints. -//TODO: Consider adding something like this (and VERIFY FILE NAME des-sync-scm): -//In addition, synchronizing your API project with a source control management (SCM) system is a best practice. To understand source control options, see xref:des-sync-scm.adoc[]. It is beyond the scope of this tutorial to address SCM setup, which is recommended for projects intended for production releases. - -. Proceed to xref:tut-af-design-api-publish-api-spec-to-exchange.adoc[]. \ No newline at end of file diff --git a/modules/ROOT/pages/tut-af-implement-am-flights-api.adoc b/modules/ROOT/pages/tut-af-implement-am-flights-api.adoc deleted file mode 100644 index 383010a0c..000000000 --- a/modules/ROOT/pages/tut-af-implement-am-flights-api.adoc +++ /dev/null @@ -1,214 +0,0 @@ -= Implementing the American Flights API Spec -//The IDE UI links to ui-tut-implement.adoc (DO NOT REMOVE WITHOUT UX/DEV ALIGNMENT) -:page-deployment-options: cloud-ide, desktop-ide -:page-aliases: ui-tut-implement.adoc, implement-api-specification.adoc, implement-an-api-specification.adoc -:page-pagination: - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - - -Import your American Flights API specification from Anypoint Exchange. Scaffold the specification into the American Flights project that you are developing, and add the logic to implement an endpoint in the API. - -== Before You Begin - -Complete these procedures: - -. xref:tut-af-design-am-flights-api.adoc[] -. xref:tut-af-integrate-am-flights.adoc[] - -== Import and Scaffold Your American Flights API Specification - -Import your American Flights API specification from Anypoint Exchange, and scaffold the specification into an interface for your American Flights integration project. - -. In Anypoint Code Builder, open your integration, `american-ws-anypoint-code-builder`. -+ -For information about this application, see xref:tut-af-integrate-am-flights.adoc[]. -// Pointer to Command Palette -include::partial$acb-reusable-steps.adoc[tags="open-command-palette"] - -. Provide this command: -+ -[source,command] ----- -MuleSoft: Import Asset from Exchange ----- -. Select *Rest API*: -+ -image::rest-api-asset-type.png["Rest API option highlighted after selecting MuleSoft: Import Asset from Exchange"] -. If prompted, log in to Anypoint Platform, allowing the extension to sign in and open an external web site and to open Visual Studio Code. -. Type the name of your American Flights API specification, for example: -+ -[source,spec name] ----- -American Flights API ----- -+ -For information about this specification, see xref:tut-af-design-am-flights-api.adoc[]. -. Wait for the IDE to load a list of matches to the name: -+ -image::select-api-asset-from-exchange.png["American Flights API asset is highlighted"] -. When prompted for a version, select the version of the API to import, such as `_1.0.0_`. -. Select *Yes* when prompted to scaffold the API dependency. -+ -This step adds the API specification as a dependency in your project's `pom.xml` file and creates a new configuration XML file, such as `american-flights-api.xml`: -+ -image::scafolded-mule-config-file.png["American-flights.xml file highlighted in the package explorer section"] -. Proceed to <>. - -[[tour-canvas]] -== Tour the Interface File - -Examine the scaffolded flows and error handlers for your interface in the canvas and configuration XML. - -image::scafolded-flow-canvas.png["The main flow is highlighted"] - -. From the *EXPLORER* menu, open the configuration file for your interface, `american-flight-api.xml`. -. Use the *Flow List* panel to navigate through flows: -+ -image::outline-list-select-flow.png["American-flights-api-main flow highlighted"] - -.. Expand the *Flow List* panel. -.. Select a flow from the list. -.. Click the flow in the canvas to highlight the flow in the configuration XML. -. In the configuration XML, locate the flows created for the endpoints in your API specification: - -* `get:\flights` -+ -[source,xml] ----- - - ----- -* `post:\flights` -+ -[source,xml] ----- - - ----- -* `get:\flights{ID}` -+ -[source,xml,linenums] ----- - - ----- -. Notice the automatically generated Error Handler components, for example: -+ -//TODO: WE SHOULD SHOW HOW TO DO SOME BASIC ERROR HANDLING... -+ -[source,xml] ----- - - - - - - - - - - - - - - - - - - - - - ----- - -. Proceed to <>. - -[[rename]] -== Name Your Interface and Implementation Files - -Provide descriptive names for the interface and implementation files in your American Flights project. The interface receives all incoming requests to your application. The scaffolded flows in the interface validate and route requests. The implementation provides the backend logic for calls to the interface. - -image::api-interface-rename.png["Rename option highlighted the context menu of american-flight-api-acb.xml file"] - -. Rename `american-flight-api-acb.xml` to `interface.xml` by right-clicking the file name, selecting *Rename*, and providing the new name. -. Rename `american-ws-anypoint-code-builder.xml` to `implementation.xml`. -. Proceed to <>. - -[[endpoint]] -== Configure an Endpoint through the Interface - -To receive HTTP requests through the interface, remove the HTTP listener from `implementation.xml`, and in your interface file (`interface.xml`), add a Flow Ref component (``) to the `getFlights` flow in your implementation. - -. Open `implementation.xml`. -+ -image::get-flights-select-listener.png["HTTP listener highlighted in the implementation.xml file"] -. Delete the *HTTP /flights* listener XML from the configuration XML: -+ -[source,xml] --- - --- -+ -.Click for the resulting flow. -[%collapsible] -==== -[source,xml] --- - - - - - - - - - - - { - ID: payload01.ID, - code: (payload01.code1 default "") ++ (payload01.code2 default ""), - price: payload01.price default 0, - departureDate: payload01.takeOffDate as String default "", - origin: payload01.fromAirport default "", - destination: payload01.toAirport default "", - emptySeats: payload01.seatsAvailable default 0, - plane: { - "type": payload01.planeType default "", - totalSeats: payload01.totalSeats default 0 - } - } - ]]> - - - - - --- -==== -. In Anypoint Code Builder, open your `interface.xml` file. -. Locate the `get:\flights:american-flights-api-config` flow: -+ -[source,xml] --- - - - --- -. Before the `` element in the flow, add a Flow Reference component (``) that references the flow `getFlights` in the implementation: -+ -[source,xml] --- - - - - --- -. Optional: Trigger a flow through your interface, and process the request with your implementation. -+ -For guidance, see xref:int-trigger-flows.adoc[]. -. Proceed to xref:tut-af-debug-am-flights.adoc[]. diff --git a/modules/ROOT/pages/tut-af-integrate-am-flights.adoc b/modules/ROOT/pages/tut-af-integrate-am-flights.adoc deleted file mode 100644 index 35f1bb84d..000000000 --- a/modules/ROOT/pages/tut-af-integrate-am-flights.adoc +++ /dev/null @@ -1,255 +0,0 @@ -= Integrating American Flights Processes -//ACB UI links to ui-tut-integrate.adoc (DO NOT REMOVE WITHOUT UX/DEV ALIGNMENT) -:page-deployment-options: cloud-ide, desktop-ide -:page-aliases: ui-tut-integrate.adoc, create-basic-integration.adoc, develop-integration.adoc -:page-pagination: - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - - -Start by creating a basic integration for the American Flights example. This integration is a Mule application that provides some of the logic for processing requests from the American Flights API. - -== Before You Begin - -Complete these procedures: - -* xref:tut-af-design-am-flights-api.adoc[] (all tasks from creating the API specification to publishing the specification to Exchange) -* Installing a REST client such as Postman or Advanced REST Client. - -== Create a Mule Application - -Start an integration application for the American Flights example. - -include::partial$acb-reusable-steps.adoc[tags="open-ide"] -+ -image::acb-mulesoft-in-activity-bar.png["MuleSoft icon in the VS Code Activity Bar"] -. From *Create*, click *Develop an Integration*: -+ -image::develop-integration-option-mat.png["Develop an Integration link highlighted in the Getting started section"] -. Provide integration project properties to the *Develop an Integration* form: -+ -image::int-create-integration-scratch.png["Create integration project from scratch.", width=70%] - -.. Under *Project Name*, type `american-ws-anypoint-code-builder`. -.. Under *Project Location*, select *Browse*, and then select your home directory. -.. Under *Create*, select *Empty Project*. -.. Select *Mule runtime* and *Java* versions. -+ -//Info about downloads and versioning: -include::anypoint-code-builder::partial$acb-runtime-java.adoc[tags="runtime-java-download;runtime-version-note;runtime-java-defaults"] -. Click *Create Project*. -+ -//Info about download notifications and location: -include::partial$acb-runtime-java.adoc[tags="runtime-java-notification"] -. Proceed to <>. - -[[configure]] -== Configure an HTTP Listener Operation and Set a Payload - -The listener is for triggering the flow, and Set Payload provides some test data for the integration: - -. If the canvas and configuration XML for the project are not open, navigate to `american-ws-anypoint-code-builder.xml` from the Explorer. -+ -image::empty-canvas-state.png["american-ws-anypoint-code-builder.xml file shown in visual representation of its Mule flow and the Mule Configuration file"] -+ -[calloutlist] -.. The canvas provides space for a visual representation of your Mule flows or subflows. -.. The configuration XML editor displays the configuration file for your Mule application. -. Select *Build a Flow* from the canvas to create an empty flow within a Mule integration application. -. Change the default name of the flow from the canvas or from the configuration XML. -+ -[tabs] -==== -From the canvas:: -+ -Click *Flow name1* to open the configuration panel for the Flow component, change the flow name to `getFlights`, and click the check mark to set the new name. -+ -image::int-flow-name-ui.png["Change name of flow through canvas."] - -From the configuration XML:: -+ -Replace the default name of the flow (`name1`) with `getFlights`. -+ -[%header,cols="1a,1a"] -|=== -| Automatically Generated Flow Element | Renamed Flow Element - -| -[source, XML] ----- - - - ----- - -| -[source, XML] ----- - - - ----- -|=== -==== - -. Add the HTTP Listener component to your configuration XML: -.. In the canvas, after your *Flow* component, click the image:icon-plus.png["",15,15] (*Add component*) icon: -+ -image::main-tutorial-add-first-http-listener.png["Plus icon highlighted in the flow"] -.. Search for and select *Listener* from the *HTTP* results: -+ -image::main-tutorial-add-first-listener.png["Listener component highlighted in the Add Component section"] -+ -The configuration XML file adds the XML for the HTTP Listener into the `` element, for example: -+ -[source,XML] ----- - - - - ----- -. In the configuration XML, place your cursor before the opening tag, and copy the following code: -+ -[source,xml] ----- - - - ----- - -. In the configuration XML, configure the attributes for the HTTP Listener configuration ``: -+ -[source,xml] ----- - - - ----- -In `` and its child element ``, set the attributes to values provided in the example. -+ -Notice that the `name` attribute changes to `inbound-request`. The `doc:id` is randomly generated and does not require a change. -. Configure the attributes for the HTTP Listener configuration: -+ -[tabs] -==== -From the canvas:: -+ -Click the *Listener* operation to open its configuration panel, and set the HTTP Listener attributes to the following values: -+ -image::tut-int-listener-component-ui.png["Configure the Listener operation through its configuration panel."] -+ -[calloutlist] -.. Change the operation name to `HTTP /flights`. -.. Select `inbound-request` from the configuration reference dropdown menu. -.. Set the *Path* attribute to `flights`. - -From the configuration XML:: -+ -In ``, set the attributes to the values provided in the example. -+ -[source,xml] ----- - - - ----- -==== -. From the canvas, add a Set Payload component after your HTTP Listener operation. -. Configure the Set Payload component attributes: -+ -[tabs] -==== -From the canvas:: -+ -Click the Set Payload component to open its configuration panel, and set the attributes to the following values: -+ -image::tut-int-set-payload-component-ui.png["Configure the Set Payload component through its configuration panel."] -+ -[calloutlist] -.. Change the component name to `Set Response`. -.. Set the *Value* attribute to `Flight info`. -From the configuration XML:: -+ -In ``, set the attributes to the values provided in the example. -+ -[source,xml] ----- - - - - - - - - - ----- -+ --- -[calloutlist] -. Set the `value` attribute to `Flight info` and the `doc:name` to `Set Response`. --- -==== -[[check-connection]] -. Before `` in the configuration XML, click *Test Connection* to check the HTTP Listener connection. -+ -The UI provides status: - -* *Verifying connection inbound-request* indicates that the test is in progress. -* *Connection is valid* indicates a successful connection. -* *Invalid Connection Got status code: 500 when trying to resolve a Mule Runtime operation* indicates a connection error. -+ -A common code `500` error is `port 8081: Address already in use`. For port conflicts, configure a different port, such as `8082`, and retest the connection. -. After receiving the *Connection is valid* message, proceed to <>. - -[[run]] -== Run Your Application in Debug Mode - -// Pointer to Run and Debug -include::partial$acb-reusable-steps.adoc[tags="open-run-debug"] -. Click the image:icon-start-debug.png["",15,15] (*Start Debugging (F5)*) icon for *Debug Mule Application*: -+ -image::run-debugger.png["Run the debugger."] -+ -Anypoint Code Builder uses Maven to build and deploy your application to its embedded Mule runtime engine. -+ -Note that using *Run* > *Start without Debugging* produces an error. -//open terminal -include::anypoint-code-builder::partial$acb-reusable-steps.adoc[tag="open-terminal"] -+ -[source, terminal] ----- -******************************************************************************* -* - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - * -******************************************************************************* -* american-ws-anypoint-code-builder-1.0.0-SNAPS * default * DEPLOYED * -******************************************************************************* ----- -. Proceed to <>. - -[[test]] -== Test Your Application - -Use the IDE's terminal to trigger the flow. - -. Submit a `curl` command from the terminal with the URL to the `/flights` endpoint to trigger the flow: -+ -[source,URI] ----- -curl http://0.0.0.0:8081/flights ----- -+ -For guidance, see xref:int-trigger-flows.adoc#trigger-flow[Trigger a Flow]. -. In your REST client or browser, check for the response *Flight info*. -+ -If you do not receive this response or if you receive a connection error, review your XML configuration, make sure your application is deployed, and recheck your HTTP Listener connection. -. After receiving the *Flight info* response, proceed to <>. - -[[stop]] -== Stop Your Application - -. In Anypoint Code Builder, select the stop icon from the toolbar: -+ -image::stop-mule-application.png["Stop icon highlighted in the toolbar"] -. Proceed to xref:tut-af-integrate-connect-to-a-db.adoc[] to import a connector from Exchange, and connect to an existing database that returns data about flights for the American Flights API. diff --git a/modules/ROOT/pages/tut-af-integrate-connect-to-a-db.adoc b/modules/ROOT/pages/tut-af-integrate-connect-to-a-db.adoc deleted file mode 100644 index 80809e194..000000000 --- a/modules/ROOT/pages/tut-af-integrate-connect-to-a-db.adoc +++ /dev/null @@ -1,182 +0,0 @@ -= Connecting to a Database from the App -:page-deployment-options: cloud-ide, desktop-ide -:page-aliases: connect-to-a-db.adoc -:page-pagination: - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - - -Use Anypoint Connector for Database (Database Connector) to connect to an external database from your Mule flow. - -== Before You Begin - -Complete xref:tut-af-integrate-am-flights.adoc[]. - -== Open Your American Flights Application - -. In Anypoint Code Builder, open `american-ws-anypoint-code-builder.xml`. -. Remove the `` component from the configuration XML: -+ -[source,xml] --- - --- - -== Add a Database Driver Dependency - -The Database Connector supports a variety of Java Database Connectivity (JDBC) databases. - -Provide the dependency for the `mySQL` driver: - -. Open the *Explorer* menu by pressing Cmd+Shift+e (Mac) or Ctrl+Shift+e (Windows). -. Open the `pom.xml` file. -. Add a new dependency within the `` element: -+ -[source,xml] --- - - mysql - mysql-connector-java - 8.0.29 - --- -+ -image::add-mysql-driver-dependency.png["pom.xml with new dependency highlighted"] -//TODO: hamburger menu -. If you receive a popup with the message `A build file was modified. Do you want to synchronize the Java classpath/configuration?`, select *Yes*. -. In the `pom.xml`, replace the existing `` element within your `mule-maven-plugin` with a new shared library: -+ -[source,xml,linenums] --- - - org.mule.tools.maven - mule-maven-plugin - ${mule.maven.plugin.version} - true - - - - mysql - mysql-connector-java - - - - --- -. If requested, accept *Yes* to sync the Java classpath. -. Proceed to <>. - -[[add-db-config]] -== Add a Database Connector Configuration - -. In Anypoint Code Builder, open `american-ws-anypoint-code-builder.xml`. -. In the configuration XML, add the following global `` configuration before the opening tag: -+ -[source,xml] ----- - - - - - -... ----- -.. Edit the attributes in `` to produce this XML configuration: -+ -[source,xml] --- - - - --- -. Review the complete configuration XML: -+ -[source,XML] --- - - - - - - - - - - - --- -+ -NOTE: The `getFlights` flow contains an expected error: `The content of element 'flow' is not complete.` This error is present until you add a connector later in this procedure. - -. Proceed to <>. - -[[write]] -== Write a Query to Return All Flights - -. From the canvas, click the image:icon-plus.png["",15,15] (*Add component*) icon after the HTTP Listener component. -. Add the *Select* operation for Anypoint Connector for Database (Database Connector). -+ -Either search for *Select* or navigate to the operation from *Connectors* > *Database* > *Select*. -. Provide this configuration for the Select operation: -+ -[tabs] -==== -From the canvas:: -+ -Click the *Select* operation to open its configuration panel, and set the Select attributes to the following values: -+ -image::tut-int-db-connector-ui.png["Configure the Select connector through its configuration panel."] -+ -[calloutlist] -.. Change the connector name to `Query Flights`. -.. Select `Database_Config` from the connector configuration dropdown menu. -.. Set *SQL Query Text* to `Select * FROM american`. - -From the configuration XML:: -+ -In ``, set the attributes to the values provided in the example. -+ -[source,XML] --- - - - - - --- -+ -Notice that the `config-ref` attribute references the database connection configuration in `` by its `name`. -==== - -. Review the complete configuration XML: -+ -[source,XML] --- - - - - - - - - - - - - - - - - --- -. Proceed to xref:tut-af-integrate-use-dataweave.adoc[] to learn how to use DataWeave to make the database response match examples in your American Flight API specification. diff --git a/modules/ROOT/pages/tut-af-integrate-use-dataweave.adoc b/modules/ROOT/pages/tut-af-integrate-use-dataweave.adoc deleted file mode 100644 index 89476774c..000000000 --- a/modules/ROOT/pages/tut-af-integrate-use-dataweave.adoc +++ /dev/null @@ -1,580 +0,0 @@ -= Transforming Flight Data with DataWeave -:page-deployment-options: cloud-ide, desktop-ide -:page-aliases: use-dataweave.adoc -:page-pagination: - -include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] - -Use DataWeave to transform and match flight data to your API spec. - -== Before You Begin - -Complete these procedures: - -. xref:tut-af-integrate-am-flights.adoc[] -. xref:tut-af-integrate-connect-to-a-db.adoc[] - -[[add-transform-component]] -== Add the Transform Message Component - -Add a Transform Message component to the flow so you can configure it to return the database payload as JSON in the next section. - -. In Anypoint Code Builder, open `american-ws-anypoint-code-builder.xml`. -. Add the Transform Message component below the *Database Select* operation. Use one of these methods: -+ -* *From the canvas:* Click the image:icon-plus.png["",15,15] (*Add component*) icon after the *Database Select* operation. In the menu, open *Core Processors* (or search for *transform*), then select *Transform Message*. -* *From the configuration XML:* Place your cursor inside the flow, after the closing tag of the *Database Select* element. Use auto-complete (Ctrl+Space or Cmd+Space), type `ee:transform` or `transform`, and select *Transform Message* from the list. -+ -The IDE inserts the component. If the inserted XML does not include `` and `` with an empty `` block, add that structure inside `` so you can add the DataWeave script in the next section. -+ -image::transform-with-output-json.png["Transform component highlighted"] -+ -.Example Transform Message component XML: -[source,xml] ----- - - - - - - - ----- - -[[return-payload]] -== Return the Payload as JSON - -. Open `american-ws-anypoint-code-builder.xml` if it is not already open (you added the Transform Message component in <>). -. Ensure the Transform Message component is present below *Database Select* (you added it in the previous section). In the configuration XML, add the `doc:name` value *Transform Message* or similar to the `` component: -+ ----- - -... ----- -. Within `` add a DataWeave script that outputs the message payload to a JSON format: -+ -[source,dataweave] --- - - - - - - - --- -. Deploy your app within the IDE by selecting *Run* > *Start Debugging (F5)*. -+ -For guidance, see xref:tut-af-integrate-am-flights.adoc#run[Run Your App in Debug Mode]. -. After the app deploys successfully, use a REST Client or browser to trigger a response. -+ -For guidance, see xref:tut-af-integrate-am-flights.adoc#test[Test Your App]. -. View the response data from the MySQL database, for example: -+ -[source,JSON] ----- -[ - { - "planeType": "Boeing 787", - "code2": "0001", - "takeOffDate": "2016-01-20T00:00:00", - "code1": "rree", - "fromAirport": "MUA", - "price": 541, - "seatsAvailable": 0, - "toAirport": "LAX", - "ID": 1, - "airlineName": "American Airlines", - "totalSeats": 200 - }, - ... -] ----- -+ -.Click for the complete response. -[%collapsible] -==== -[source,json] ----- -[ - { - "planeType": "Boeing 787", - "code2": "0001", - "takeOffDate": "2016-01-20T00:00:00", - "code1": "rree", - "fromAirport": "MUA", - "price": 541, - "seatsAvailable": 0, - "toAirport": "LAX", - "ID": 1, - "airlineName": "American Airlines", - "totalSeats": 200 - }, - { - "planeType": "Boeing 747", - "code2": "0123", - "takeOffDate": "2016-01-25T00:00:00", - "code1": "eefd", - "fromAirport": "MUA", - "price": 300, - "seatsAvailable": 7, - "toAirport": "CLE", - "ID": 2, - "airlineName": "American Airlines", - "totalSeats": 345 - }, - { - "planeType": "Boeing 777", - "code2": "0192", - "takeOffDate": "2016-01-20T00:00:00", - "code1": "ffee", - "fromAirport": "MUA", - "price": 300, - "seatsAvailable": 0, - "toAirport": "LAX", - "ID": 3, - "airlineName": "American Airlines", - "totalSeats": 300 - }, - { - "planeType": "Boeing 737", - "code2": "1000", - "takeOffDate": "2016-01-20T00:00:00", - "code1": "rree", - "fromAirport": "MUA", - "price": 200, - "seatsAvailable": 5, - "toAirport": "CLE", - "ID": 4, - "airlineName": "American Airlines", - "totalSeats": 150 - }, - { - "planeType": "Boeing 737", - "code2": "1093", - "takeOffDate": "2016-02-11T00:00:00", - "code1": "rree", - "fromAirport": "MUA", - "price": 142, - "seatsAvailable": 1, - "toAirport": "SFO", - "ID": 5, - "airlineName": "American Airlines", - "totalSeats": 150 - }, - { - "planeType": "Boeing 787", - "code2": "1112", - "takeOffDate": "2016-01-20T00:00:00", - "code1": "ffee", - "fromAirport": "MUA", - "price": 954, - "seatsAvailable": 100, - "toAirport": "CLE", - "ID": 6, - "airlineName": "American Airlines", - "totalSeats": 200 - }, - { - "planeType": "Boeing 777", - "code2": "1994", - "takeOffDate": "2016-01-01T00:00:00", - "code1": "eefd", - "fromAirport": "MUA", - "price": 676, - "seatsAvailable": 0, - "toAirport": "SFO", - "ID": 7, - "airlineName": "American Airlines", - "totalSeats": 300 - }, - { - "planeType": "Boeing 737", - "code2": "2000", - "takeOffDate": "2016-02-20T00:00:00", - "code1": "ffee", - "fromAirport": "MUA", - "price": 300, - "seatsAvailable": 30, - "toAirport": "SFO", - "ID": 8, - "airlineName": "American Airlines", - "totalSeats": 150 - }, - { - "planeType": "Boeing 737", - "code2": "3000", - "takeOffDate": "2016-02-01T00:00:00", - "code1": "eefd", - "fromAirport": "MUA", - "price": 900, - "seatsAvailable": 0, - "toAirport": "SFO", - "ID": 9, - "airlineName": "American Airlines", - "totalSeats": 150 - }, - { - "planeType": "Boeing 777", - "code2": "4511", - "takeOffDate": "2016-01-15T00:00:00", - "code1": "eefd", - "fromAirport": "MUA", - "price": 900, - "seatsAvailable": 100, - "toAirport": "LAX", - "ID": 10, - "airlineName": "American Airlines", - "totalSeats": 300 - }, - { - "planeType": "Boeing 737", - "code2": "4567", - "takeOffDate": "2016-01-20T00:00:00", - "code1": "rree", - "fromAirport": "MUA", - "price": 456, - "seatsAvailable": 100, - "toAirport": "SFO", - "ID": 11, - "airlineName": "American Airlines", - "totalSeats": 150 - } -] ----- -==== -+ -If the MySQL test server is not available, this error occurs: -+ -[[source,error]] ----- -Cannot get connection for URL jdbc:mysql://mudb.learn.mulesoft.com:3306/ : -Communications link failure. ----- -+ -To address the issue, try again until you get a successful response. -. Proceed to <>. - -[[restructure]] -== Transform the Response Data - -Transform the JSON output to the structure required by your API specification. - -Your *American Flights API* in Anypoint Exchange uses a different structure for its flight data than your request to the database returns. - -To find the required JSON structure, search for the JSON example under the GET method for your `/flights` endpoint. For guidance, see xref:publish-api-spec-to-exchange.adoc#locate-your-api-in-exchange[Locate Your API in Exchange] or open the https://anypoint.mulesoft.com/exchange/68ef9520-24e9-4cf2-b2f5-620025690913/training-american-flights-api/minor/2.0/console/method/%2373/[public version of the API on Exchange^]. - -[%header,%autowidth.spread,cols="1a,1a"] -|=== -| API Specification Response Structure | Actual Response Structure -| -[source,json] --- -[ - { - "code": "ER38sd", - "price": 400, - "departureDate": "2017/07/26", - "origin": "CLE", - "destination": "SFO", - "emptySeats": 0, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - } -] --- -| -[source,json] --- -[ - { - "planeType": "Boeing 787", - "code2": "0001", - "takeOffDate": "2016-01-20T00:00:00", - "code1": "rree", - "fromAirport": "MUA", - "price": 541, - "seatsAvailable": 0, - "toAirport": "LAX", - "ID": 1, - "airlineName": "American Airlines", - "totalSeats": 200 - } -] --- -|=== - -Use DataWeave to transform the response: - -. In the configuration XML, replace the script within the `` with a DataWeave mapping: -+ -[source,xml] --- - - - - { - ID: payload01.ID, - code: (payload01.code1 default "") ++ (payload01.code2 default ""), - price: payload01.price default 0, - departureDate: payload01.takeOffDate as String default "", - origin: payload01.fromAirport default "", - destination: payload01.toAirport default "", - emptySeats: payload01.seatsAvailable default 0, - plane: { - "type": payload01.planeType default "", - totalSeats: payload01.totalSeats default 0 - } - } - ]]> - - - --- -. Review your configuration XML: -+ -[source,xml] ----- - - - - - - - - - - - - - - - - - - - - { - ID: payload01.ID, - code: (payload01.code1 default "") ++ (payload01.code2 default ""), - price: payload01.price default 0, - departureDate: payload01.takeOffDate as String default "", - origin: payload01.fromAirport default "", - destination: payload01.toAirport default "", - emptySeats: payload01.seatsAvailable default 0, - plane: { - "type": payload01.planeType default "", - totalSeats: payload01.totalSeats default 0 - } - } - ]]> - - - - ----- -. Proceed to <>. - -[[run-test]] -== Run and Test Your App - -. Deploy your app within the IDE by executing to *Run* > *Start Debugging (F5)*. -+ -For guidance, see xref:tut-af-integrate-am-flights.adoc#run[Run Your App in Debug Mode]. -. After the app deploys successfully, use a REST Client or browser to trigger flow. -+ -For guidance, see xref:tut-af-integrate-am-flights.adoc#test[Test Your App]. -+ -Notice that the transformed data structure conforms to the API requirements, for example: -+ -[source,JSON] ----- -[ - { - "ID": 1, - "code": "rree0001", - "price": 541, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "LAX", - "emptySeats": 0, - "plane": { - "type": "Boeing 787", - "totalSeats": 200 - } - }, - ... ----- -+ -[%collapsible] -.Click for the complete response. -==== -[source,JSON] ----- -[ - { - "ID": 1, - "code": "rree0001", - "price": 541, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "LAX", - "emptySeats": 0, - "plane": { - "type": "Boeing 787", - "totalSeats": 200 - } - }, - { - "ID": 2, - "code": "eefd0123", - "price": 300, - "departureDate": "2016-01-25T00:00:00", - "origin": "MUA", - "destination": "CLE", - "emptySeats": 7, - "plane": { - "type": "Boeing 747", - "totalSeats": 345 - } - }, - { - "ID": 3, - "code": "ffee0192", - "price": 300, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "LAX", - "emptySeats": 0, - "plane": { - "type": "Boeing 777", - "totalSeats": 300 - } - }, - { - "ID": 4, - "code": "rree1000", - "price": 200, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "CLE", - "emptySeats": 5, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - }, - { - "ID": 5, - "code": "rree1093", - "price": 142, - "departureDate": "2016-02-11T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 1, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - }, - { - "ID": 6, - "code": "ffee1112", - "price": 954, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "CLE", - "emptySeats": 100, - "plane": { - "type": "Boeing 787", - "totalSeats": 200 - } - }, - { - "ID": 7, - "code": "eefd1994", - "price": 676, - "departureDate": "2016-01-01T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 0, - "plane": { - "type": "Boeing 777", - "totalSeats": 300 - } - }, - { - "ID": 8, - "code": "ffee2000", - "price": 300, - "departureDate": "2016-02-20T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 30, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - }, - { - "ID": 9, - "code": "eefd3000", - "price": 900, - "departureDate": "2016-02-01T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 0, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - }, - { - "ID": 10, - "code": "eefd4511", - "price": 900, - "departureDate": "2016-01-15T00:00:00", - "origin": "MUA", - "destination": "LAX", - "emptySeats": 100, - "plane": { - "type": "Boeing 777", - "totalSeats": 300 - } - }, - { - "ID": 11, - "code": "rree4567", - "price": 456, - "departureDate": "2016-01-20T00:00:00", - "origin": "MUA", - "destination": "SFO", - "emptySeats": 100, - "plane": { - "type": "Boeing 737", - "totalSeats": 150 - } - } -] ----- -==== -. Stop your app. -+ -For guidance, see xref:tut-af-integrate-am-flights.adoc#stop[Stop Your App]. -. Proceed to xref:tut-af-implement-am-flights-api.adoc[]. diff --git a/modules/ROOT/pages/tutorials.adoc b/modules/ROOT/pages/tutorials.adoc index 271342361..ed622be0b 100644 --- a/modules/ROOT/pages/tutorials.adoc +++ b/modules/ROOT/pages/tutorials.adoc @@ -1,17 +1,34 @@ = Tutorials :page-deployment-options: cloud-ide, desktop-ide -:page-aliases: user-guide.adoc +:page-aliases: user-guide.adoc, tut-af-amflights-overview.adoc include::reuse::partial$beta-banner.adoc[tag="anypoint-code-builder"] //LOGO (web, desktop, or both) // include::partial$acb-ide-logos.adoc[tags="both-ides"] -Follow these hands-on tutorials to learn how to design, implement, and integrate APIs using Anypoint Code Builder. +Learn how to design, implement, integrate, and deploy APIs with Anypoint Code Builder. Work through these numbered product topics to move from API specification design to a deployed Mule application. For end-to-end walkthroughs that focus on one scenario each, see <>. -* xref:tut-af-amflights-overview.adoc[]: +[[modular-learning-paths]] +== Take Your API Specification from Design Through Deployment + +The following topics guide you step by step from API specification design in the IDE to publishing the contract on Anypoint Exchange, building and configuring integration flows, importing and scaffolding the API into a Mule interface, and deploying the application to CloudHub or CloudHub 2.0. + +. xref:des-designing-api-specs.adoc[Designing API Specs and Fragments] for supported languages and the overall design workflow. +. xref:des-create-api-specs.adoc[Creating and Importing API Specifications], including the API Console and mocking service. +. Optionally xref:des-create-api-fragments.adoc[Creating and Using API Spec Fragments] for reusable types and examples from Anypoint Exchange. +. xref:des-publish-api-spec-to-exchange.adoc[Publishing API Projects to Exchange] so your team can discover and implement the contract. +. xref:int-create-integrations.adoc[Creating Integrations] and xref:int-configure-components.adoc[Configuring Components] in your flows. +. xref:int-configure-dw-expressions.adoc[Using DataWeave Expressions and Transformations] to map, reshape, or validate data between connectors, processors, and your API layer. +. xref:imp-implement-api-specs.adoc[Implementing OAS, RAML, AsyncAPI, and GraphQL APIs] + -Use Anypoint Code Builder to design and implement an API specification example called American Flights API that returns flight information from a MySQL database. +Import your API specification from Exchange, scaffold it into an interface in your project, then wire flows to your implementation. +. xref:int-developing-integrations.adoc[Developing Integrations], including xref:int-debug-mule-apps.adoc[Debugging Mule Applications] and xref:int-deploy-mule-apps.adoc[Deploying Mule Apps to CloudHub and CloudHub 2.0]. + +[[hands-on-tutorials]] +== Hands-On Tutorials + +Each linked tutorial is a self-contained walkthrough that applies Anypoint Code Builder to one integration style, API technology, or connector story from start to finish. * xref:tut-local-api-specification.adoc[]: +