diff --git a/tutorials/btp-integration-suite-integral-api-management/API_product.png b/tutorials/btp-integration-suite-integral-api-management/API_product.png deleted file mode 100644 index 8b83ba87d..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/API_product.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/api_key.png b/tutorials/btp-integration-suite-integral-api-management/api_key.png deleted file mode 100644 index e5ef39608..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/api_key.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/basic_authentication_policy.png b/tutorials/btp-integration-suite-integral-api-management/basic_authentication_policy.png deleted file mode 100644 index f4c2ed369..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/basic_authentication_policy.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/btp-integration-suite-integral-api-management.md b/tutorials/btp-integration-suite-integral-api-management/btp-integration-suite-integral-api-management.md deleted file mode 100644 index b4c39f899..000000000 --- a/tutorials/btp-integration-suite-integral-api-management/btp-integration-suite-integral-api-management.md +++ /dev/null @@ -1,226 +0,0 @@ ---- -auto_validation: true -time: 20 -tags: [ tutorial>advanced, tutorial>free-tier, software-product>sap-integration-suite, software-product>cloud-integration, software-product>sap-api-management, software-product>sap-business-technology-platform ] -primary_tag: software-product>sap-api-management -parser: v2 -author_name: Mariajose Martinez -author_profile: https://github.com/mariajosesap ---- -# Configure SAP API Management policies to avoid CORS issues and generate an API Key - Learn how to set up API Management policies to avoid CORS issues when calling the API endpoint from SAP Build Apps (formerly SAP AppGyver), also you will learn how to apply security policies to enable the API consumption via an API Key. - -## Prerequisites - - - You have a SAP BTP account or trial account with access to the SAP Integration Suite. - - You have completed the previous tutorial [Send SMS using SAP Cloud Integration while consuming a Twilio API](btp-integration-suite-integral-cpi-urlencoded). - - -## You will learn - - - How to set up API Management policies to avoid CORS issues when calling the API endpoint. - - How to apply security policies to enable the API consumption via an API Key. - -### Set up the policy to avoid CORS issues - -1. Go to your SAP API Portal (in the main SAP Integration Suite portal). - -2. Create an API and select URL. Here you're going to paste your IFlow endpoint from past tutorials. Give it a name: `APIBestRunDemo`. Give it a path: `/https/salesOrder`, and service type `REST`. - - ![Create the API](create_api.png) - -3. After creating it, go to the Proxy Endpoint tab and add the following in this order, and save it: - - ![Add the route rules](route_rules.png) - -4. Now, go to Policies (if it doesn't show up in the top-right of your screen, click on the 3 dots). - - Here you'll add the required policies to avoid CORS issues while calling this API from SAP Build Apps and configure the API Key policy later on. - -5. On the Edit Mode, start adding the Policies as followed: - - In the PostFlow inside the Proxy Endpoint configuration, add an `Assign Message` policy as an `OutgoingResponse` and name it `setCORS`. Like this: - - ![Add the route rules](create_set_cors_policy.png) - -6. Copy and paste this script: - - - ```XML - - - - -
*
-
set-cookie, origin, accept, maxdataserviceversion, x-csrf-token, authorization, dataserviceversion, accept-language, x-http-method, content-type, X-Requested-With, apikey
-
3628800
-
GET, PUT, POST, DELETE
-
set-cookie, x-csrf-token, x-http-method
-
-
- false - response -
- ``` - >Notice that you're already adding `apikey` as a header in the policy. - - You should look it like this: - - ![CORS Policy](set_cors_policy.png) - -7. In the ProxyEndpoint click on `+` to add one. Name it `preflight` and in the condition string paste: `request.verb == "OPTIONS"`. Like this: - - ![Preflight Condition String](preflight.png) - - This is all you need to avoid CORS issues when calling our API from SAP Build Apps. - - >On write "preflight" step, you may find a bug on the API Management UI, where the Update button stay on grey/disable. To avoid it and save your changes, you must create a dummy assign message anywhere, save it and then remove it. - -### Create a Key Value Map for your SAP Cloud Integration Credentials - -1. Before adding the needed policies, create first a Key Value Map with your CPI credentials (to access the Cloud Integration Platform API endpoint). You will need this credential to reference it in the API Key Policy. - - Go to Configure (click on the tool icon) -> go to the `Key Value Maps` tab and create one. - - - ![Create a Key Value Map](key_value_map.png) - -2. Put `CPICredentials` as the name and declare your CPI credentials (username and password). Check the `Encrypt Key Value Map` box. - - - - ![Create a Key Value Map](create_cpi_credentials.png) - -### Add the Verify API Key Policy - -Go back to your API policies. - -In the TargetEndpoint, add 3 policies in the PreFlow. - -1. Add a Key Value Map Operations policy, name it and leave it as a Incoming Request. This is needed to get the CPI Credentials created before, as a Key Value Map. Like this: - - ![Create a Key Value Map](key_value_policy.png) - - Copy and Paste this script (you will be referencing 'CPICredentials' with the mapIdentifier parameter): - - - ```XML - - - - username - - - - password - - environment - - ``` - Like this: - - ![Set up the Key Value Map Policy](setup_key_value_policy.png) - -2. Add a Basic Authentication policy, name it and leave it with the `IncomeRequest` stream. Like this: - - ![Add a Basich Authentication Policy](basic_authentication_policy.png) - - Copy and paste this script: - - - ```XML - - - Encode - false - - - - - - - request.header.Authorization - - ``` - - You should look it like this: - - ![Set up a Basich Authentication Policy](setup_basic_authentication_policy.png) - -3. Add a API Key verification policy to request the API Key every time the API is called (you'll later need to create the API Product and subscribe to the application to get the API Key). Add the `Verify API Key` policy, same in the PreFlow. Like this: - - ![Set up a Basich Authentication Policy](setup_basic_authentication_policy.png) - - - ```XML - - - - - ``` - - This should be the first policy to be triggered. Make sure it is set it up as the first one (you can change the order with the arrows in the top-right). Like this: - - ![Set up Verify API Key Policy](setup_verify_api_key.png) - -4. Click on Update, Save and Deploy your API project. - - ![Deploy your API](deploy_api.png) - -### Create an API Product and Subscribe to the Application - -1. Now you need to create the API Product. Go to the pencil icon (develop), click on the `Products` tab and create one. Put this name to your Product `APIBestRunDemoProduct`. - - ![Create an API Product](create_product.png) - -3. Reference your API to your Product. - - ![Reference your API](reference_your_api.png) - -4. Publish your Product, click on `Publish`. - -5. Then, go to the API Business Hub Enterprise portal. - - ![Publish you Product](publish_api.png) - - You should be able to see it in your SAP API Business Hub: - - ![API Product](API_product.png) - -6. Enter the API product and subscribe it by creating a new Application: - - ![Create API Application](create_api_application.png) - - Name it `APIBestRunDemoApplication`, like this: - - ![Create API Application](create_api_application_name.png) - - -7. Here's where you can get your API Key, crucial to authenticate to this API endpoint when consuming its service. - - ![Create API Application](api_key.png) - -Now you've successfully created policies to avoid CORS issues and enable an API Key to authenticate and consume your API endpoint from SAP Integration Suite. - -### Add additional tasks into your Integration Flow - -Right now, as following the whole exercises, the IFlow is returning us the SMS message sent by consuming the Twilio API. But for the purpose of the exercise with SAP Build Apps, you're going to use as the return message, mainly the receipt URL when the payment transaction is successfully done with Stripe. For this, you need to save this message in the IFlow and retrieve it at the end of the IFlow. - -Remember the previous tutorial about "Set up Write, Filter and Get Tasks in the Integration Flow…" for filtering the payment data and later calling the SAP C4C OData service? well, you are going to do the same, but in this case to retrieve the receipt URL from the Stripe request response. - -1. Go back to SAP Cloud Integration and to your Integration Flow. Add a Write task after the Stripe Connector request reply, and configure the task as following: - - ![Add a Write Task](write_task.png) - -2. And now add a Get task at the end of the IFlow to retrieve this returned message: - - ![Add a Get Task](get_task.png) - - Save and deploy your IFlow. - -Now, it's time to set up the integration with SAP Build Apps. Check out the next and final tutorial of this series: [Integrate SAP Build Apps with SAP Integration Suite](btp-integration-suite-integral-appgyver). - -### Check your knowledge - -### One more time, check your knowledge \ No newline at end of file diff --git a/tutorials/btp-integration-suite-integral-api-management/create_api.png b/tutorials/btp-integration-suite-integral-api-management/create_api.png deleted file mode 100644 index 9e71416ab..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/create_api.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/create_api_application.png b/tutorials/btp-integration-suite-integral-api-management/create_api_application.png deleted file mode 100644 index cbb58b201..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/create_api_application.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/create_api_application_name.png b/tutorials/btp-integration-suite-integral-api-management/create_api_application_name.png deleted file mode 100644 index 0c80d1b64..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/create_api_application_name.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/create_cpi_credentials.png b/tutorials/btp-integration-suite-integral-api-management/create_cpi_credentials.png deleted file mode 100644 index ac5ad6227..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/create_cpi_credentials.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/create_product.png b/tutorials/btp-integration-suite-integral-api-management/create_product.png deleted file mode 100644 index 2a151f52a..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/create_product.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/create_set_cors_policy.png b/tutorials/btp-integration-suite-integral-api-management/create_set_cors_policy.png deleted file mode 100644 index 96aca1c62..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/create_set_cors_policy.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/deploy_api.png b/tutorials/btp-integration-suite-integral-api-management/deploy_api.png deleted file mode 100644 index bd4b571a4..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/deploy_api.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/get_task.png b/tutorials/btp-integration-suite-integral-api-management/get_task.png deleted file mode 100644 index 27ae50f18..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/get_task.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/key_value_map.png b/tutorials/btp-integration-suite-integral-api-management/key_value_map.png deleted file mode 100644 index 0cdfa68f1..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/key_value_map.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/key_value_policy.png b/tutorials/btp-integration-suite-integral-api-management/key_value_policy.png deleted file mode 100644 index 812ee3bf3..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/key_value_policy.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/preflight.png b/tutorials/btp-integration-suite-integral-api-management/preflight.png deleted file mode 100644 index 8e4e5ccd8..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/preflight.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/publish_api.png b/tutorials/btp-integration-suite-integral-api-management/publish_api.png deleted file mode 100644 index a5ffbe5cd..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/publish_api.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/reference_your_api.png b/tutorials/btp-integration-suite-integral-api-management/reference_your_api.png deleted file mode 100644 index 1b8be2db2..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/reference_your_api.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/route_rules.png b/tutorials/btp-integration-suite-integral-api-management/route_rules.png deleted file mode 100644 index 8631567dd..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/route_rules.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/set_cors_policy.png b/tutorials/btp-integration-suite-integral-api-management/set_cors_policy.png deleted file mode 100644 index edde860da..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/set_cors_policy.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/setup_basic_authentication_policy.png b/tutorials/btp-integration-suite-integral-api-management/setup_basic_authentication_policy.png deleted file mode 100644 index 02410e670..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/setup_basic_authentication_policy.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/setup_key_value_policy.png b/tutorials/btp-integration-suite-integral-api-management/setup_key_value_policy.png deleted file mode 100644 index 61f9c13f9..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/setup_key_value_policy.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/setup_verify_api_key.png b/tutorials/btp-integration-suite-integral-api-management/setup_verify_api_key.png deleted file mode 100644 index e4942bfb5..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/setup_verify_api_key.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/verify_api_policy.png b/tutorials/btp-integration-suite-integral-api-management/verify_api_policy.png deleted file mode 100644 index 0d2b2f8d2..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/verify_api_policy.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-api-management/write_task.png b/tutorials/btp-integration-suite-integral-api-management/write_task.png deleted file mode 100644 index dc4883ce0..000000000 Binary files a/tutorials/btp-integration-suite-integral-api-management/write_task.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/add_button.png b/tutorials/btp-integration-suite-integral-appgyver/add_button.png deleted file mode 100644 index b5fe275b8..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/add_button.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/add_productid.png b/tutorials/btp-integration-suite-integral-appgyver/add_productid.png deleted file mode 100644 index 728ed362b..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/add_productid.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/adding_api_appgyver.png b/tutorials/btp-integration-suite-integral-appgyver/adding_api_appgyver.png deleted file mode 100644 index 0c9e2b313..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/adding_api_appgyver.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/adding_resource_url.png b/tutorials/btp-integration-suite-integral-appgyver/adding_resource_url.png deleted file mode 100644 index f205c323d..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/adding_resource_url.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/adding_schema_properties.png b/tutorials/btp-integration-suite-integral-appgyver/adding_schema_properties.png deleted file mode 100644 index 2d07a7a88..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/adding_schema_properties.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/api_key_header.png b/tutorials/btp-integration-suite-integral-appgyver/api_key_header.png deleted file mode 100644 index 395c7e192..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/api_key_header.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/appgyver_complete_test.png b/tutorials/btp-integration-suite-integral-appgyver/appgyver_complete_test.png deleted file mode 100644 index 10e9fdc9e..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/appgyver_complete_test.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/bind_receipt_url.png b/tutorials/btp-integration-suite-integral-appgyver/bind_receipt_url.png deleted file mode 100644 index 335e616c0..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/bind_receipt_url.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/bind_value_receipt_url.png b/tutorials/btp-integration-suite-integral-appgyver/bind_value_receipt_url.png deleted file mode 100644 index 8128f50fc..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/bind_value_receipt_url.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/binding_create_record.png b/tutorials/btp-integration-suite-integral-appgyver/binding_create_record.png deleted file mode 100644 index 1b4ad5b9b..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/binding_create_record.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/btp-integration-suite-integral-appgyver.md b/tutorials/btp-integration-suite-integral-appgyver/btp-integration-suite-integral-appgyver.md deleted file mode 100644 index 2e00a84e7..000000000 --- a/tutorials/btp-integration-suite-integral-appgyver/btp-integration-suite-integral-appgyver.md +++ /dev/null @@ -1,273 +0,0 @@ ---- -auto_validation: true -time: 25 -tags: [ tutorial>intermediate, tutorial>free-tier, software-product>sap-integration-suite, software-product>sap-business-technology-platform, software-product>sap-appgyver,software-product>sap-build ] -primary_tag: software-product>sap-appgyver -parser: v2 -author_name: Mariajose Martinez -author_profile: https://github.com/mariajosesap ---- -# Integrate SAP Build Apps with SAP Integration Suite - how to test request calls in SAP Build Apps (formerly SAP AppGyver) to a SAP Integration Suite API and how to set up the needed schema for sending payloads. - -## Prerequisites - - - You have a SAP BTP account or trial account with access to the SAP Integration Suite. - - You have a SAP Build Apps account or trial account. - - You have completed the previous tutorial [Configure SAP API Management policies to avoid CORS issues and generate an API Key](btp-integration-suite-integral-api-management). - - -## You will learn - - - How to test request calls in SAP Build Apps to a SAP Integration Suite API. - - How to set up the needed schema for sending payloads. - - How to retrieve data from a request call's response. - -### Add the API Endpoint in SAP Build Apps - -1. Go to your SAP Build Apps custom app, click on `Data` on the menu and Add a Data Resource and select `REST API direct integration`. Remember that for this exercise, it is needed to create first a custom mobile application from this [blog post](https://blogs.sap.com/2022/05/08/get-data-from-a-json-object-by-scanning-a-qr-code-with-sap-appgyver/). - - ![Creating a new API connection](adding_api_appgyver.png) - -2. Copy and paste your API endpoint from SAP API Management as the base resource URL and name your Data Resource. Enter the name: `IntegrationSuite_API_CORS`. - - ![Adding API endpoint](adding_resource_url.png) - -3. Click on the `Create Record (POST)` section, make sure `id` is erased from the relative path and enter your API Key as a header (make sure you don't put it as optional and mark it as static). - - ![Adding the API Key as a header](api_key_header.png) - -4. Set up the custom needed schema for testing a POST request. Remember the payload structure you are using for this exercise: - - - ```JSON - { - "AppGyverSalesOrder": { - "customer": { - "ObjectID": "", - "BuyerPartyID": - }, - "paymentData": { - "amount": , - "customer": "", - "currency": "", - "source": "", - "description": "Test payment via CPI" - }, - "product": [ - { - "ProductID": "", - "Quantity": - } - ] - } - } - ``` - So to "translate it" into the custom schema in SAP Build Apps, you'll need to add these properties manually, as shown in the following image: - - ![Adding the schema propertis for Payloads to be sent](adding_schema_properties.png) - -5. Click on the Test tab and open your custom object, where you are going to add the values as the payload for testing. - - ![Adding some values to test the call](values_for_testing.png) - - And setting for testing purposes a Product ID from SAP Sales and Service core (formerly SAP Cloud for Customer or SAP C4C). - - ![Set Product Id from SAP Sales and Service Core to test it](set_productid.png) - -6. Save it and now click on `Run Test`. You should see this response `Status: OK`: - - ![Test response](test_response.png) - -7. If you check on your Stripe developers account, you can see the amount and description "Ta da!! Integration scenario is set up": - - ![Test Stripe charge](test_stripe.png) - -### Create a variable from the request call's response - -1. Click on Set Schema From Response to let Build Apps know you want to create a variable for getting the receipt URL. - - ![Set schema from response](set_schema_response.png) - -2. Now you can see `receipt_url` from the return message, as a property, like in the following image. Save your configuration. - - ![Save schema from response](save_schema_response.png) - -3. Create a variable to enable this `receipt_url` as a variable to be linked in your application UI. - - Click again on `Data` to close it and go back to your application design. Click on `View – Variables` and click on `Add Page Variable` as it is in the following image: - - ![Create a page variable](create_page_variable.png) - -### Update your variables to send the Payload - -Remember you're following this previous exercise of a custom application developed in SAP Build Apps (as mentioned in the prerequisites first tutorial). The differences are: - -1. Add one field to the QR code `ProductID` for the purpose of the integration exercise and update the variables you've already created in the SAP Build Apps app. Of course, in reality you would want to add as many Product fields as necessary to execute the Sales Order transaction. - -2. Add an additional Button (to trigger the API call) and an `WebView` component (to see the Stripe's payment confirmation with the `receipt url`). - -### Create a page variable with a new JSON Object - -1. Go back to your QR code generator (you can use this [one](https://www.qr-code-generator.com/)), and paste this JSON object. You may need to change the model and URL too, if you want to test your integration with a different product defined in your SAP Sales and Service Core tenant (SAP Cloud for Customer): - - - ```JSON - { - "ProductID": "", - "model": "Samsung French Door 29 ft", - "imgURL": "https://samsungmx.vtexassets.com/arquivos/ids/180853-800-auto?width=800&height=auto&aspect=true" - } - ``` - Save the generated QR Code: - - ![Create a page variable](save_generated_qrcode.png) - -2. Go back to your SAP Build Apps custom app, and click on `View – Variables`, go to Page Variables and update them by adding `ProductID` as a new property of the parsed Json object: - - ![Add Product ID into your page variable](add_productid.png) - -3. Click again in `View – Variables` to go back to your UI editor, change the first title of the Product from `brand` to the `model` page variable, to make it consistent with the generated QR code: - - ![Link you Parsed JSON defined page variable to the button](link_parsed_jason_button.png) - -4. Add the `ProductID` page variable to the second Product component: - - ![Link you Product ID variable to a text field](link_productid.png) - -5. Leave the image URL as it is in the [original exercise](https://blogs.sap.com/2022/05/08/get-data-from-a-json-object-by-scanning-a-qr-code-with-sap-appgyver/). - -### Configure with a button the request call trigger - -1. Add the button and change its name to `Create Order consuming CPI`: - - ![Add a button](add_button.png) - -2. Add the `WebView` component (this one, you have to install it): - - ![Add a button](install_web_view.png) - -3. And link it to the page variable `receipt_url` you created before. Like this: - - ![Link the receipt url page variable to the WebView component](link_receipt_url_page_variable.png) - -4. Select the button and click on the bottom-right "Show logic for BUTTON" and add a `Create Record` logic component. - - - In the Resource name: select the Data Resource Id you created before `IntegrationSuite_API_CORS` - - For the Records properties: here you'll see the custom schema we created before for requesting POST calls from SAP Build Apps. - - ![Create Record Logic](create_record.png) - -5. Click on `Record properties` -> `Custom object`. And add the newly created property: `ProductID`. - - ![Create Record Product ID](create_record_productid.png) - - After save it, you'll see it like this in the Product List Object: - - ![Save Create Record](create_record_productid_saved.png) - - If you want, you can create as may variables as you want to make the exercise more dynamic. As I mentioned before, for the purpose of the integration exercise I'm using only `ProductID`. You'll see your payload structured in Build Apps, like this: - - ![Data Binding](binding_create_record.png) - - Click on Save. - -6. Add a JavaScript logic component, this is to configure the getting of the `receipt_url` from the Stripe request response. - - ![JavaScript Component](javascript_component.png) - -7. Erase the original `input1` name and change it for `response`. Click to bind the data. - - ![JavaScript Component](javascript_setup.png) - - Select the binding type: Output value of another node, then create record and select `receipt_url` as field you want to get from the response. - - ![Get Receipt URL from Response](create_record_response_receipt_url.png) - - Save it and close it. - -8. Add a Dialog Toast, just to show up a message that the request call was successful. Write as a Toast Message `Loading URL`, like this: - - ![Add Dialog Toast Message](dialog_toast.png) - -9. Add a `Set page variable` logic component and add as the variable name the page variable you created before `receipt_url`: - - ![Set Page Variable](set_page_variable.png) - -10. Link the variable like this and save it: - - ![Bind Receipt URL to the page variable](bind_receipt_url.png) - -11. Do the same for assigning the value. Here you are going to link it with the `receipt_url` JavaScript component you created before: - - ![Bind Receipt URL as the assigned value](bind_value_receipt_url.png) - -Now it's time to test the app and the whole integration. - -### Test the whole integration scenario - -1. Grab your phone and enter your SAP Build Apps mobile app. Link it to your account as explained in the original exercise. Read the generated QR code: - - ![Product QR Code](generated_qrcode.png) - -2. Click on `Create Order consuming CPI` and you'll see that the order was successfully created. Like this: - - ![AppGyver Complete Test](appgyver_complete_test.png) - -3. Check in the SAP Sales and Service Core tenant (formerly SAP Cloud for Customer / SAP C4C): - - ![SAP Sales and Service Core test](c4c_test.png) - -Congratulations! You've successfully created an end-to-end integration scenario leveraging low-code/no-code capabilities from the SAP Integration Suite and SAP Build Apps, for integrating SAP and third-party solutions. - -### Review the conclusions - -Just to summarize, you've integrated solutions and services from: - -- SAP Sales and Service Core (formerly SAP C4C) -- Twilio -- Stripe -- SAP Integration Suite: - - SAP Open Connectors - - SAP API Management - - SAP Cloud Integration -- SAP Build Apps (formerly SAP AppGyver) - -To create a Sales Order in SAP Sales and Service Core, after a the payment transaction using Stripe is successful, and then sending a SMS with the Order Id confirmation. - -Hope you've enjoyed this exercise! - -### Check your knowledge - -### One more time, check your knowledge - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tutorials/btp-integration-suite-integral-appgyver/c4c_test.png b/tutorials/btp-integration-suite-integral-appgyver/c4c_test.png deleted file mode 100644 index 0534918d7..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/c4c_test.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/create_page_variable.png b/tutorials/btp-integration-suite-integral-appgyver/create_page_variable.png deleted file mode 100644 index d1dbf234c..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/create_page_variable.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/create_record.png b/tutorials/btp-integration-suite-integral-appgyver/create_record.png deleted file mode 100644 index b2e5ce425..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/create_record.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/create_record_productid.png b/tutorials/btp-integration-suite-integral-appgyver/create_record_productid.png deleted file mode 100644 index b43cd8354..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/create_record_productid.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/create_record_productid_saved.png b/tutorials/btp-integration-suite-integral-appgyver/create_record_productid_saved.png deleted file mode 100644 index c385e961f..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/create_record_productid_saved.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/create_record_response_receipt_url.png b/tutorials/btp-integration-suite-integral-appgyver/create_record_response_receipt_url.png deleted file mode 100644 index 4a4e5bab6..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/create_record_response_receipt_url.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/dialog_toast.png b/tutorials/btp-integration-suite-integral-appgyver/dialog_toast.png deleted file mode 100644 index a26a80fb9..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/dialog_toast.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/generated_qrcode.png b/tutorials/btp-integration-suite-integral-appgyver/generated_qrcode.png deleted file mode 100644 index d80f13a42..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/generated_qrcode.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/install_web_view.png b/tutorials/btp-integration-suite-integral-appgyver/install_web_view.png deleted file mode 100644 index 14aba3407..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/install_web_view.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/javascript_component.png b/tutorials/btp-integration-suite-integral-appgyver/javascript_component.png deleted file mode 100644 index 8ae43ce29..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/javascript_component.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/javascript_setup.png b/tutorials/btp-integration-suite-integral-appgyver/javascript_setup.png deleted file mode 100644 index caed6b308..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/javascript_setup.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/link_parsed_jason_button.png b/tutorials/btp-integration-suite-integral-appgyver/link_parsed_jason_button.png deleted file mode 100644 index 754fc6fa8..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/link_parsed_jason_button.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/link_productid.png b/tutorials/btp-integration-suite-integral-appgyver/link_productid.png deleted file mode 100644 index 9dafaf5ab..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/link_productid.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/link_receipt_url_page_variable.png b/tutorials/btp-integration-suite-integral-appgyver/link_receipt_url_page_variable.png deleted file mode 100644 index 1ebd51565..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/link_receipt_url_page_variable.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/save_generated_qrcode.png b/tutorials/btp-integration-suite-integral-appgyver/save_generated_qrcode.png deleted file mode 100644 index 086bb3be7..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/save_generated_qrcode.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/save_schema_response.png b/tutorials/btp-integration-suite-integral-appgyver/save_schema_response.png deleted file mode 100644 index 708ba1ba4..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/save_schema_response.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/set_page_variable.png b/tutorials/btp-integration-suite-integral-appgyver/set_page_variable.png deleted file mode 100644 index a0e518ec6..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/set_page_variable.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/set_productid.png b/tutorials/btp-integration-suite-integral-appgyver/set_productid.png deleted file mode 100644 index fabd7c742..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/set_productid.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/set_schema_response.png b/tutorials/btp-integration-suite-integral-appgyver/set_schema_response.png deleted file mode 100644 index 8e4c5e9be..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/set_schema_response.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/test_response.png b/tutorials/btp-integration-suite-integral-appgyver/test_response.png deleted file mode 100644 index fe9a489cb..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/test_response.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/test_stripe.png b/tutorials/btp-integration-suite-integral-appgyver/test_stripe.png deleted file mode 100644 index 457d5fb8c..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/test_stripe.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/values_for_testing.png b/tutorials/btp-integration-suite-integral-appgyver/values_for_testing.png deleted file mode 100644 index ed20fe5ab..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/values_for_testing.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-appgyver/webview.png b/tutorials/btp-integration-suite-integral-appgyver/webview.png deleted file mode 100644 index 9afbd4e7b..000000000 Binary files a/tutorials/btp-integration-suite-integral-appgyver/webview.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/btp-integration-suite-integral-cpi-tasks.md b/tutorials/btp-integration-suite-integral-cpi-tasks/btp-integration-suite-integral-cpi-tasks.md deleted file mode 100644 index 26233303f..000000000 --- a/tutorials/btp-integration-suite-integral-cpi-tasks/btp-integration-suite-integral-cpi-tasks.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: Save, Filter and Get your needed data in your Integration Flow -description: Boost your Integration Suite skills leveraging different tasks to store and filter messages travelling through your Integration Flow. -auto_validation: true -time: 10 -tags: [ tutorial>beginner, tutorial>free-tier, software-product>sap-integration-suite, software-product>cloud-integration, software-product>sap-business-technology-platform ] -primary_tag: software-product>sap-integration-suite -parser: v2 -author_name: Mariajose Martinez -author_profile: https://github.com/mariajosesap ---- - -## Prerequisites - - - You have a SAP BTP account or trial account with access to the SAP Integration Suite. - - You have completed the previous tutorial [Consume a Stripe service from SAP Open Connectors and SAP Cloud Integration to create payment transactions](btp-integration-suite-integral-openconnectors). - - -## You will learn - - - How to store, get and filter data to prepare your payload for specific request calls within the Integration Flow. - -### Add Converters, Write and Filter Tasks - -1. As SAP Cloud Integration works with XML and the expected payload from Open Connector/Stripe is in JSON, you need to add a JSON to XML converter in order to store the initial payload from SAP Build Apps in CPI and retrieve it when the payment transaction is successfully done. - -2. Uncheck the "Add XML Root Element" box. You'll use the payload with the root as it comes. - - ![Adding the JSON to XML Converter](json_to_xml.png) - -3. Add a Write task to store the initial payload you are going to send from SAP Build Apps. Select it from the cube "Persistence" and "Data Store Operations". - - ![Write Task](write_task.png) - -4. Add the following: - - - Data Store Name: `AppGyverSavedPayload` - - Visibility: Integration Flow - - Entry ID: message1 - - Retention Threshold for Alerting (in days): reduce it to 1 day. - - Expiration Period (in days): reduce it to 2 days. - - Uncheck the "Encrypt Stored Message" box. For this exercise you are not going to encrypt the message. - - ![Write Task](write_task_setup.png) - -5. Add a "Filter" task. This is needed to only send the payment data to stripe. - -6. Add this `Xpath` Expression in the Processing Tab: `/AppGyverSalesOrder/paymentData` and select `Nodelist` as the `Valuetype`. It is needed to select `Nodelist` as there is a list in the main payload: - - - ```JSON - { - "AppGyverSalesOrder": { - "customer": { - "ObjectID": "", - "BuyerPartyID": - }, - "paymentData": { - "amount": , - "customer": "", - "currency": "", - "source": "", - "description": "Test payment via CPI" - }, - "product": [ - { - "ProductID": "", - "Quantity": - } - ] - } - } - ``` - - >Note: Bear in mind that the "customer" and "product" objects are included as part of the whole scenario. You'll need them for requesting SAP Sales and Service Core a sales order creation, which you'll see in the next tutorial. - - It should look like this: - - ![Filter Task](filter_task.png) - -7. Add a XML to JSON converter. Stripe needs a JSON object to create the payment transaction. Make sure you select UTF-8 as the JSON Output Encoding, and check the box "Suppress JSON Root Element", this is important to be able to enter the data inside the `XPath` Expression without the "parent" root: - - ![XML to JSON Converter](xml_to_json.png) - -### Test your Integration Flow - -1. Test on Postman and check the payment transaction is still working, use the Payload structure as it is above, just change it to your data. You should be able to generate the payment transaction. - - ![Testing it with Postman](test_postman.png) - -2. Go back to Monitor. Remember you need to enable first the Trace option. Check the trace: - - ![Checking the trace](check_trace.png) - - -### Add a Get Task - -1. Add a Get task to retrieve the initial payload. You have to put the same name and entry ID as you did in the Write task. Check the "Delete On Completion" box, to delete the stored message when the Integration Flow transaction is completed. - - ![Get Task](get_task.png) - - You can test again if you want to, you should see the whole initial payload as it was saved with the Write task. - - Remember to activate the Trace log after deploying your IFlow. Go to the Monitor Message Processing and Trace. - - ![Log the trace](trace_log.png) - -Now, you have successfully retrieve the initial payload using Write and Get task, plus learnt how to filter data using Filter task and `XPath` expressions. - -Following the Tutorial Series, you now need to configure the SAP Sales and Service Core API consumption to create Sales Orders. For this step, check out the next tutorial: [Consume a SAP Sales and Service Core API to create Sales Orders using SAP Cloud Integration](btp-integration-suite-integral-sales-core). - -### Check your knowledge - diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/check_trace.png b/tutorials/btp-integration-suite-integral-cpi-tasks/check_trace.png deleted file mode 100644 index 3e914289d..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-tasks/check_trace.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/filter_task.png b/tutorials/btp-integration-suite-integral-cpi-tasks/filter_task.png deleted file mode 100644 index 088472137..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-tasks/filter_task.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/get_task.png b/tutorials/btp-integration-suite-integral-cpi-tasks/get_task.png deleted file mode 100644 index d5a071d9e..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-tasks/get_task.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/json_to_xml.png b/tutorials/btp-integration-suite-integral-cpi-tasks/json_to_xml.png deleted file mode 100644 index 3f97c9137..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-tasks/json_to_xml.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/test_postman.png b/tutorials/btp-integration-suite-integral-cpi-tasks/test_postman.png deleted file mode 100644 index a8196f269..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-tasks/test_postman.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/trace_log.png b/tutorials/btp-integration-suite-integral-cpi-tasks/trace_log.png deleted file mode 100644 index fdcb5ff9f..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-tasks/trace_log.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/write_task.png b/tutorials/btp-integration-suite-integral-cpi-tasks/write_task.png deleted file mode 100644 index 4f8ef6d81..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-tasks/write_task.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/write_task_setup.png b/tutorials/btp-integration-suite-integral-cpi-tasks/write_task_setup.png deleted file mode 100644 index e3128d20b..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-tasks/write_task_setup.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-tasks/xml_to_json.png b/tutorials/btp-integration-suite-integral-cpi-tasks/xml_to_json.png deleted file mode 100644 index 10ccf1e43..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-tasks/xml_to_json.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/btp-integration-suite-integral-cpi-urlencoded.md b/tutorials/btp-integration-suite-integral-cpi-urlencoded/btp-integration-suite-integral-cpi-urlencoded.md deleted file mode 100644 index 0b7221e12..000000000 --- a/tutorials/btp-integration-suite-integral-cpi-urlencoded/btp-integration-suite-integral-cpi-urlencoded.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -auto_validation: true -time: 10 -tags: [ tutorial>intermediate, tutorial>free-tier, software-product>sap-integration-suite, software-product>cloud-integration, software-product>sap-business-technology-platform ] -primary_tag: software-product>sap-integration-suite -parser: v2 -author_name: Mariajose Martinez -author_profile: https://github.com/mariajosesap ---- -# Send SMS using SAP Cloud Integration while consuming a Twilio API - - Learn how to pass parameters with URL encoded form to a HTTP receiver adapter, to send SMS messages using a Twilio API, as a notification that the Order has been successfully created. - -## Prerequisites - - - You have a SAP BTP account or trial account with access to the SAP Integration Suite. - - You have completed the previous tutorial [Consume a SAP Sales and Service Core API to create Sales Orders using SAP Cloud Integration](btp-integration-suite-integral-sales-core). - - You have a Twilio account or trial account. In the Twilio documentation, you'll see 3 needed URL encoded parameters to be sent to trigger the API call, which are: - - - From - - To - - Body - - Keep in mind that in fact the recommended way to consume Twilio APIs, is by leveraging its Connector with SAP Open Connectors, as you used in a previous tutorial with Stripe. This exercise is to learn how to do it with a standard HTTP adapter. - -## You will learn - - - How to pass parameters with URL encoded form to a HTTP receiver adapter, to send SMS messages using a Twilio API, as a notification that the Order has been successfully created. - -### Get the Sales Order Id from SAP Sales and Service Core - -To continue from the previous tutorial where you configured a SAP Sales and Service Core API to create sales orders, now what you need to get the sales order id and send a SMS with a custom message, consuming the Twilio "create a message" API. Here's the Twilio API [documentation](https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource). - -1. Add a Content Modifier task and in the Exchange Property tab, add a new property: - * Action: Create - * Name: `salesOrderId` - * Source Type: `XPath` - * Source Value: `/CustomerOrderCollection/CustomerOrder/ID` - * Data Type: java.lang.String - - Like this: - - ![Get the sales order](get_sales_order.png) - - Now as you are going to send dynamic SMS with different sales orders Id for every time you run the demo, you need to add a Groovy Script task to configure our new needed Body for the Twilio SMS API. - -2. Add a Groovy Script and create a new script by clicking in the page and plus + icon while selecting the Groovy task: - - ![Add Groovy script](groovy_script.png) - - Copy and paste this code: - - - ```Javascript - import com.sap.gateway.ip.core.customdev.util.Message; - import java.util.HashMap; - def Message processData(Message message) { - //Properties - def properties = message.getProperties(); - salesOrder = properties.get("salesOrderId"); - messageText = ("Thank you for your purchase, your order id is " + salesOrder) - message.setProperty("encodedMessageText", java.net.URLEncoder.encode(messageText, "UTF-8")); - return message; - } - ``` - - You should see it like this: - - ![Add Groovy script](groovy_script2.png) - -### Prepare headers and body to send x-www-form-urlencoded data to the Twilio service - -As you can see, you don't need to add the headers here or the body, as you will use another Content Modifier to set them up. You are just getting the `salesOrderId` from the SAP Sales and Service core API response and concatenating it with the text message you want to send as a body in the SMS. You can also configure the same to get the phone number of the related customer and use it in the encoded message body to dynamically change the recipient's phone number as needed. For this exercise, just do it with the sales order id. - -1. Add another Content Modifier and you are going to add the Content-Type as a header. Keep in mind that SAP Cloud Integration is case sensitive, so be sure to type down Content-Type with the C and T in capital letters. - - In the source value, copy and paste: application/x-www-form-urlencoded - - ![Adding the Content-Type in the header](header.png) - -2. Go now to the Message Body, and here you're going to use the type "Expression" (as the sales order and phone number will change in real life in every order). - - As Twilio requires the message to be sent with an encoded URL, you can practice/check the message to be encoded. This is the web page that I used to encode the body as Twilio needs it. - - Remember how Twilio needs the parameters to be sent: - - - From - - To - - Body - - And by passing these parameters together, its needed to add the ampersand symbol "&" between them. Like this (this is an example): - - `From=inputValue1&To=inputValue2&Body=inputValue3` - - ![Adding the Content-Type in the header](url_encoder.png) - -3. Go back to your second Content Modifier and in the Message Body tab, change the type to Expression and add your encoded text message and needed parameters: - - ![Adding the Content-Type in the header](twilio_message_body.png) - -### Add the request call to post the message to the Twilio SMS API - -1. Add a Request Reply task, a Receiver's box and a HTTP receiver adapter. - - >Keep in mind that in fact the recommended way to consume Twilio APIs, is by leveraging its Connector with SAP Open Connectors, as you demonstrate in a previous tutorial with Stripe. However I wanted to conduct the API consumption directly just for testing and documentation purposes. - - In the connection tab you'll need to specify your Twilio's API endpoint (remember to check the documentation). Create your Twilio developer account's credentials in SAP Cloud Integration, and extremely important: add as a Request Header the "Content-Type" header as defined in the 2nd content type. This is key to send the URL encoded parameters to trigger the Twilio create a message's API. - - ![Adding the HTTP adapter](twilio_http_adapter.png) - - -### Create Twilio credentials in SAP Cloud Integration - -1. Click on Security Materials -> create and select User Credentials type and paste your Twilio API credentials: `account_sid` as user and `auth_token` as password. You can find your credentials in your Twilio developers' console. - - You should see it like this: - - ![Adding the Content-Type in the header](create_twilio_credentials.png) - - Save and deploy your IFlow. - -### Test your Integration Flow - -1. Test the whole Integration Flow. Remember to activate the "Trace" mode in your already deployed IFlow: - - ![Adding the Content-Type in the header](test_integration_flow.png) - -2. Use Postman for testing my CPI API endpoint with the same initial payload mentioned in the previous tutorials: - - - ```JSON - { - "AppGyverSalesOrder": { - "customer": { - "ObjectID": "", - "BuyerPartyID": - }, - "paymentData": { - "amount": , - "customer": "", - "currency": "", - "source": "", - "description": "Test payment via CPI" - }, - "product": [ - { - "ProductID": "", - "Quantity": - } - ] - } - } - ``` - - ![Test your integration flow](test_integration_flow.png) - - If you want to, check in the Monitor Processing Message and Trace how the message was encoded: - - ![Check the trace](check_trace.png) - - And the SMS: - - ![SMS](sms.png) - -Great! you've successfully have learned how to send SMS in Cloud Integration consuming a Twilio API. - -Now it's time add security policies to the API endpoint using SAP API Management. Check this next tutorial: [Configure SAP API Management policies to avoid CORS issues and generate an API Key](btp-integration-suite-integral-api-management). - -### Check your knowledge - -### One more time, check your knowledge - - - diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/check_trace.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/check_trace.png deleted file mode 100644 index acb1715a9..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/check_trace.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/create_twilio_credentials.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/create_twilio_credentials.png deleted file mode 100644 index 827e74cab..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/create_twilio_credentials.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/get_sales_order.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/get_sales_order.png deleted file mode 100644 index 6aa2068bf..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/get_sales_order.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/groovy_script.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/groovy_script.png deleted file mode 100644 index 563c18a8e..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/groovy_script.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/groovy_script2.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/groovy_script2.png deleted file mode 100644 index 8b9917d20..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/groovy_script2.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/header.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/header.png deleted file mode 100644 index f6129683f..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/header.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/sms.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/sms.png deleted file mode 100644 index cd7447988..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/sms.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/test_integration_flow.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/test_integration_flow.png deleted file mode 100644 index 52dcc29f2..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/test_integration_flow.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/test_postman.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/test_postman.png deleted file mode 100644 index 6a6e020e4..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/test_postman.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/twilio_http_adapter.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/twilio_http_adapter.png deleted file mode 100644 index f9d4755f2..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/twilio_http_adapter.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/twilio_message_body.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/twilio_message_body.png deleted file mode 100644 index 108122c72..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/twilio_message_body.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-cpi-urlencoded/url_encoder.png b/tutorials/btp-integration-suite-integral-cpi-urlencoded/url_encoder.png deleted file mode 100644 index 90aee05be..000000000 Binary files a/tutorials/btp-integration-suite-integral-cpi-urlencoded/url_encoder.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/add_target_message.png b/tutorials/btp-integration-suite-integral-sales-core/add_target_message.png deleted file mode 100644 index 7badea837..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/add_target_message.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/api_business_hub.png b/tutorials/btp-integration-suite-integral-sales-core/api_business_hub.png deleted file mode 100644 index 52c1078a6..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/api_business_hub.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/btp-integration-suite-integral-sales-core.md b/tutorials/btp-integration-suite-integral-sales-core/btp-integration-suite-integral-sales-core.md deleted file mode 100644 index dce96f0f0..000000000 --- a/tutorials/btp-integration-suite-integral-sales-core/btp-integration-suite-integral-sales-core.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -title: Consume a SAP Sales and Service Core API to create Sales Orders using SAP Cloud Integration -description: Learn how to create a Message Mapping artifact to correctly pass the needed payload to SAP Sales and Service Core (formerly SAP C4C) to create the saler order. Plus you'll see how to configure and test your XSD schemas for the source and target messages. -auto_validation: true -time: 30 -tags: [ tutorial>advanced, tutorial>license, software-product>sap-integration-suite, software-product>cloud-integration, software-product>sap-business-technology-platform, tutorial>free-tier ] -primary_tag: software-product>sap-integration-suite -parser: v2 -author_name: Mariajose Martinez -author_profile: https://github.com/mariajosesap ---- - -## Prerequisites - - - You have a SAP BTP account or trial account with access to the SAP Integration Suite. - - You have a SAP Sales and Service Core (SAP Cloud for Customer / SAP C4C) tenant. - - You have completed the previous tutorial [Save, Filter and Get your needed data in your Integration Flow](btp-integration-suite-integral-cpi-tasks). - - -## You will learn - - - How to create a Message Mapping artifact to correctly pass the needed payload to SAP Sales and Service Core to create the sales order. Plus you'll see how to configure and test your XSD schemas for the source and target messages. - -### Add the SAP Sales and Service Core service to the Integration Flow - -Once you have your SAP Sales and Service Core tenant (formerly SAP Cloud for Customer or SAP C4C): - -1. Click on [SAP API Business Hub](https://api.sap.com/api/salesorder/resource), to start testing your C4C API. - -2. Click on "Try Out" and enter your tenant domain. - -3. Add `/CustomerOrderCollection` as the Resource Path to POST new Sales Orders in C4C. Your API endpoint is `https:///sap/c4c/odata/v1/c4codataapi`. - - ![API Business Hub](api_business_hub.png) - - >In order to call the SAP Sales and Service Core API to create a Sales Order in your Integration Flow, a Message Mapping will be needed to map the XML of the incoming payload to the needed structure in SAP Sales and Service Core. This will be cover in a later step. - -4. Go back to your Integration Flow and add a Request Reply task. - -5. Add a new Receiver and link it with the Request Reply task using an OData Adapter (select the OData V2). For more information, check the documentation [here](https://help.sap.com/docs/CLOUD_INTEGRATION/368c481cd6954bdfa5d0435479fd4eaf/c5c2e38e0c87472e996dfda04920bfc4.html). - -7. Add your SAP Sales and Service Core API endpoint and credentials. - - ![API Business Hub](request_reply_c4c.png) - -### Create the SAP Sales and Service Core credentials in SAP Cloud Integration - -To create the credentials, follow the same steps used to create the Open Connector credentials in the previous tutorial. - -1. Click on the 'eye icon' (Monitor) -> 'Security Material' tile and create the credentials to access your SAP Sales and Service Core (SAP C4C) environment. Use 'User Credentials' as the Type. And Deploy it. - - ![Setting up the C4C credentials](c4c_credentials.png) - -### Configure the SAP Sales and Service Core target fields for the request call - -1. Go back to the Integration Flow and by selecting the OData adapter, go to the Connection tab and add: - - - Address: paste your SAP C4C API endpoint as mentioned above. - - Proxy type: Internet - - Authentication: Basic - - Credential Name: paste the credential name you configured - - And check the box "CSRF Protected": this is very important because it automatically requests the CSRF token (simulates the GET request call) to later request the POST call to create the sales order. - - ![Setting up the C4C request call](setup_c4c_call.png) - -2. Go to the Processing tab. Search in the Resource Path for `CustomerOrderCollection` and download the XSD schema (this will be your XSD schema for your target message). - - ![Setting up the C4C request call](setup_c4c_call2.png) - -3. Click on Select and Leave the data as it shows and click on Step 2. - - ![Setting up the C4C request call](connecting_c4c.png) - -4. Change the Operation to "Create (POST) and look for `CustomerOrderCollection` as the entity (as mentioned at the beginning of the blog). Go to the Sub Level "1", this is important to be able to send `CustomerOrderItems` (such as product items). - -5. In the Fields, check the box to: - - - `ObjectID` - - `BuyerPartyID` - - Inside `CustomerOrderItem`, select: - - `ProductID` - - `ObjectID` - - Quantity - - You could add more fields if you want to, but for the purpose of this tutorial, you can leave it with those. - - ![Setting up the C4C fields for the request call](c4c_fields.png) - - You should see them like the following image. - -6. Select these values: - - As Content Type: Atom - - Content Type Encoding: UTF-8 - - ![Add additional values](setup_c4c_call3.png) - - -### Create a Message Mapping Artifact - -1. Create the Message Mapping artifact. Click on the path at the top "CPI Best Run Demo". Be sure to be on Edit mode to add the artifact. - - ![Creating a Message Artifact call](create_message_artifact.png) - - Enter the artifact. And you will see this page: - - ![Message Mapping View](mapping_message_1.png) - - The source message is going to be the payload coming from the SAP Build Apps application (which you have not created yet here), but in other words it's the payload from the application that you are going to send to the Cloud Integration Flow. - - The Target Message is the XSD schema you created in the previous step while configuring the `CustomerOrderCollection` Post rules, with the fields you selected (mainly `ProductID`, `BuyerID`, quantity, etc.). - -2. Upload the XSD schema from the `CustomerOrderCollection`. Be sure to be on Edit mode. - - - Source: Integration Flow - - Package: CPI Best Run Demo - - Integration Flow: `CPIsalesIntegrationFlow` - -3. Select and add the generated XSD schema. - - ![Target XSD Schema](select_schema.png) - -4. Click on "Add target message" and select the XSD schema. - - You should see it like this (it is on red because you haven't mapped them with the source message yet). - - ![Adding the Target XSD Schema](add_target_message.png) - -5. Upload the needed source XSD schema. Manually convert the JSON Payload structure to a XSD structure. - - Remember this is the payload structure of the exercise: - - - ```JSON - { - "AppGyverSalesOrder": { - "customer": { - "ObjectID": "", - "BuyerPartyID": - }, - "paymentData": { - "amount": , - "customer": "", - "currency": "", - "source": "", - "description": "Test payment via CPI" - }, - "product": [ - { - "ProductID": "", - "Quantity": - } - ] - } - } - ``` - - By converting it to XML, it should look like this (replace the XXXX with your data): - - - ```XML - - - - XXXXXX - XXXXXX - - - XXXXXX - XXXXXX - XXXXXX - XXXXXX - XXXXXX - - - XXXXXX - XXX - - - ``` - - You can also download the target XSD schema to use it as a guide to build the source XSD schema. - -6. Create the source XSD schema. Save the following schema as a local file. Later, you'll use it to upload it to the Message Mapping artifact. - - - ```XSD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ``` - - ``` - Remember that when you are setting the possible values for each XSD element, using minOccurs and maxOccurs, you need to make it consistent with the Message Mapping artifact messages' structures. You'll be able to see them in the source and target message's structure, and these are the definitions: - - - 1..1 -> needs and allows only one value. - - 0..1 -> doesn't need a value but if there is, it would be only one. - - 0..* -> it can go from no value to multiple values. - ``` - -### Test your XML structure with the needed XSD source schema. - -1. Save the Payload converted to XML in a local file (use this name "payloadInputSimulation.xml"), to test the Message Mapping. - -2. Validate it with the source XSD schema before uploading the source XSD schema to the Message Mapping artifact. - - A helpful editor: Notepad++ and XML vs XSD validation in this [link](https://www.utilities-online.info/xsdvalidation). - - This is how it looks (using the validation's link above): - - ![Validating XML and XSD source schema](validating_xml_xsd_files.png) - -### Upload your source XSD schema into the Message Mapping Artifact and map it to the target XSD schema - -1. Save the XSD schema as local files in your computer, and upload it as the source XSD schema file as you uploaded the target one. Name it appgyverSchema.xsd - - ![Uploading the source XSD schema](source_schema.png) - -2. Click on "Add source message" and select it. You should see it like this: - - ![Linking the source XSD schema](source_schema2.png) - -3. Now it is time to map them together. - - For the 2 ones that are hanging (`CustomerOrderItem` father and `ObjectiID` child) map them to a constant as shown in the screenshot. - - ![Linking the source XSD schema](mapped_schemas.png) - -4. Save it, deploy it and click on Simulate on the top-right, to test the Message Mapping. It is important you save it and deploy it first to avoid issues while doing the simulation testing. - -5. Upload the Payload converted to XML and click on "Test". It can take some seconds/minutes to load the first time. When it is done, you should see this message "Mapping test completed". - - ![Testing the mapping](test_mapping.png) - -### Add the Message Mapping Artifact to the Integration Flow - -1. Click on the pencil icon "Design", select your package and enter your Integration Flow artifact. - -2. Add the Message Mapping you just created as a Resource for the Integration Flow to consume. Make sure you click anywhere (blank space in your Integration Flow) and maximize the configuration panel below in the Edit mode. Go to the tab "Resources" and inside click on the "References" tab. Click on Add and add your Message Mapping artifact. - - ![Adding the artifact as a resource](mapping_resourced.png) - -3. Add a Message Mapping task in the Integration Flow. Once selected, go to the "Processing tab" click in select and in the Reference resource you should see it, select it. - - ![Adding the Message Mapping task](message_mapping_task.png) - - You should see it like this: - - ![Adding the Message Mapping task](message_mapping_task2.png) - - Don't mind the warning signs, the Integration Flow is going to work. With this message mapping, you are ensuring that the payload message is readable to send the payload to C4C and create the Sales Order with the info provided. - - Integration Suite works best with XML messages, there are some transactions you can run with messages in JSON, but for complex message transformations or mappings like you did above, it is highly recommended (and needed) to adopt XML and XSD format/structures. - -### Deploy and test your Integration Flow - -1. Save your IFlow and deploy it. If you want to export your package, make sure you save your Integration Flow and Message Mapping with versions. - - When the deployment is finished, test the integration again using Postman as you did in the previous tutorial when testing the Stripe Open Connector. - -2. Click on the eye icon "Monitor", and click on "Manage Integration Content". When the Status changes to "Started", change the Log Level to "Trace" to be able to trace any potential error, then copy the API endpoint to use it on Postman, with your SAP Business Technology Platform credentials, send the JSON payload (as mentioned previously). - - ![Testing the Integration Flow](test_monitor.png) - -3. Execute the call in Postman and return to Cloud Integration, click on Monitor Message Processing to check the messages until the end. Remember to activate the Trace log after deploying your IFlow. You should able to see all calls in 200 OK, and the end response message from SAP Sales and Service Core with a XML format. - - And you should see the Message content in the "Monitor Message Processing" capability, with the response of the API, with a Sales Order already generated, like this: - - ![Trace message](trace_message.png) - -Now you have already set up in the right way the OData receiver adapter to create Sales Orders in SAP Sales and Service Core, while configure a Message Mapping artifact to transform the payload with the XML and XSD schema needed for this Sales Order creation. - -Now as a next step, you are going to send a SMS as a notification that the order was successfully created, leveraging a Twilio SMS API in the next tutorial: [Send SMS using SAP Cloud Integration while consuming a Twilio API](btp-integration-suite-integral-cpi-urlencoded). - -### Check your knowledge - -### One more time, check your knowledge - diff --git a/tutorials/btp-integration-suite-integral-sales-core/c4c_credentials.png b/tutorials/btp-integration-suite-integral-sales-core/c4c_credentials.png deleted file mode 100644 index 6f7aef83a..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/c4c_credentials.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/c4c_fields.png b/tutorials/btp-integration-suite-integral-sales-core/c4c_fields.png deleted file mode 100644 index aec5c5725..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/c4c_fields.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/connecting_c4c.png b/tutorials/btp-integration-suite-integral-sales-core/connecting_c4c.png deleted file mode 100644 index 96cd629e3..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/connecting_c4c.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/create_message_artifact.png b/tutorials/btp-integration-suite-integral-sales-core/create_message_artifact.png deleted file mode 100644 index 89609d384..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/create_message_artifact.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/mapped_schemas.png b/tutorials/btp-integration-suite-integral-sales-core/mapped_schemas.png deleted file mode 100644 index eb7d687ce..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/mapped_schemas.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/mapping_message_1.png b/tutorials/btp-integration-suite-integral-sales-core/mapping_message_1.png deleted file mode 100644 index 56322add0..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/mapping_message_1.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/mapping_resourced.png b/tutorials/btp-integration-suite-integral-sales-core/mapping_resourced.png deleted file mode 100644 index 273bfb26c..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/mapping_resourced.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/message_mapping_task.png b/tutorials/btp-integration-suite-integral-sales-core/message_mapping_task.png deleted file mode 100644 index d0c1da047..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/message_mapping_task.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/message_mapping_task2.png b/tutorials/btp-integration-suite-integral-sales-core/message_mapping_task2.png deleted file mode 100644 index f38af9d8a..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/message_mapping_task2.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/request_reply_c4c.png b/tutorials/btp-integration-suite-integral-sales-core/request_reply_c4c.png deleted file mode 100644 index ce266d545..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/request_reply_c4c.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/select_schema.png b/tutorials/btp-integration-suite-integral-sales-core/select_schema.png deleted file mode 100644 index 995cb58d8..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/select_schema.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/setup_c4c_call.png b/tutorials/btp-integration-suite-integral-sales-core/setup_c4c_call.png deleted file mode 100644 index 700708d39..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/setup_c4c_call.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/setup_c4c_call2.png b/tutorials/btp-integration-suite-integral-sales-core/setup_c4c_call2.png deleted file mode 100644 index 6b715a77a..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/setup_c4c_call2.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/setup_c4c_call3.png b/tutorials/btp-integration-suite-integral-sales-core/setup_c4c_call3.png deleted file mode 100644 index e676a23dd..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/setup_c4c_call3.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/source_schema.png b/tutorials/btp-integration-suite-integral-sales-core/source_schema.png deleted file mode 100644 index a31b5f828..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/source_schema.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/source_schema2.png b/tutorials/btp-integration-suite-integral-sales-core/source_schema2.png deleted file mode 100644 index a65ef6900..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/source_schema2.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/test_mapping.png b/tutorials/btp-integration-suite-integral-sales-core/test_mapping.png deleted file mode 100644 index a94e7614e..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/test_mapping.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/test_monitor.png b/tutorials/btp-integration-suite-integral-sales-core/test_monitor.png deleted file mode 100644 index 981e75b8f..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/test_monitor.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/trace_message.png b/tutorials/btp-integration-suite-integral-sales-core/trace_message.png deleted file mode 100644 index b087be20c..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/trace_message.png and /dev/null differ diff --git a/tutorials/btp-integration-suite-integral-sales-core/validating_xml_xsd_files.png b/tutorials/btp-integration-suite-integral-sales-core/validating_xml_xsd_files.png deleted file mode 100644 index 8fdffb937..000000000 Binary files a/tutorials/btp-integration-suite-integral-sales-core/validating_xml_xsd_files.png and /dev/null differ