Skip to Content

Push a Sales Order Card to Your Mobile Device

test
0 %
Push a Sales Order Card to Your Mobile Device
Details

Push a Sales Order Card to Your Mobile Device

August 12, 2021
Created by
August 16, 2020
Push a card to the mobile device by triggering an action in an external system.

You will learn

  • How to push a card to your mobile device from an external system
  • How to view and delete subscription cards on your mobile device
QR code

Prerequisites


Step 1: Understand the use case

In the previous tutorial of this group, you created a card that will be used by the Sales Managers to Approve / Reject sales orders.

In this tutorial, you will mimic Watson’s request by triggering a request from an external system. Once the request is created, Alice will receive a push notification.

Log on to answer question
Step 2: Create service key
  1. Open your Mobile Services Cockpit.

    CPMS Cockpit
  2. Click SAP Mobile Cards.

    Mobile Cards Cockpit View
  3. Navigate to Service Keys tab and click + to create a new service key.

    Service Keys Tab

    > If you can’t see the Service Keys tab, refresh your page.

  4. Enter/Select the values as indicated in the table, and click OK.

    Alias Role
    RegisterCardServiceKey register_card
    New Service Keys

You can now see the newly created service key in the table.

Make a note of the Alias, API Key, and the URL for your service key. You will be using these values in an upcoming step.

Service Keys Table
Log on to answer question
Step 3: Copy receiver's user name
  1. In the Mobile Services cockpit, Click Features tab → Push Notification.

    Push Notification Feature
  2. In the Push Registrations tab, make a note of your User Name. You will need it in an upcoming step.

    Push Notification Feature

    If you are unable to determine your User Name, use the Send Notification to send a custom message as a push notification.

Log on to answer question
Step 4: Copy sales order ID
  1. Click Features Tab → Mobile Sample OData ESPM.

    Sample Data Feature
  2. Click V2.

    Sample Data Cockpit
  3. Access /SalesOrderHeaders Entity in the browser window that opens.

    Sample Data in Browser
  4. Make a note of a Sales Order ID. You will need it in the next step.

    Sales Order Headers
Log on to answer question
Step 5: Make HTTP request

Make sure you are choosing the preferred tab above: Postman or cURL.

In this step, you will make an HTTP Request. This knowledge is transferrable, i.e. you can implement this logic in your Web/Desktop/Mobile applications.

  1. Create your HTTP Request by using the following configuration:
    • Request Type & URL

    HTTP Method Type URL
    POST <The URL you copied from the service key table>/mobileservices/origin/hcpms/CARDS/v1/register/templated
    • Authorization
    Authorization Type Username Password
    BASIC RegisterCardServiceKey <The API Key you copied from the service key table>
    • Headers
    Key Value
    Content-Type application/json
    • Body - Raw → JSON
    {
      "method": "REGISTER",
      "username": "<The User Name you copied from the Push Registration table>",
      "templateName": "Sales Push Card BAS",
      "parameters": {
        "SalesOrderID": "<The Sales Order Id you copied from the Sample OData Service>"
      }
    }
    
  1. Use Base64 encoding to encode the following:

    RegisterCardServiceKey:<The API Key you copied from the service key table>

  2. Use the following cURL code to make the HTTP request. You will need to modify the text mentioned in < >.

curl --location --request POST '<The URL you copied from the service key table>/mobileservices/origin/hcpms/CARDS/v1/register/templated' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic <BASE_64 Encoded Value>' \
--data-raw '{
  "method": "REGISTER",
  "username": "<The User Name you copied from the Push Registration table>",
  "templateName": "Sales Order Push Card",
  "parameters": {
    "SalesOrderID": "<The Sales Order Id you copied from the Sample OData Service>"
  }
}'
Log on to answer question
Step 6: View notification on device

Make sure you are choosing the right device platform tab ( Android or iOS ) above.

Before proceeding, ensure that you have created a Push Card by following this tutorial.

  1. Either terminate the app or send it to background.

    Android Background
  2. Upon a successful HTTP Request call, you will see a New card added notification; Tap on the notification to see thee card.

    Android Notification
  3. Tap on the card to to open it.

    Android Home
  4. You can now see a sales order card for the Sales Order ID you specified in the HTTPS request method.

    Android Pushed Card
  1. Either terminate the app or send it to background.

    iOS Background
  2. Upon a successful HTTP Request call, you will see a New card added notification; Tap on the notification.

    iOS Notification
  3. Tap on the card to to open it.

    iOS Placeholder
  4. You can now see a sales order card for the Sales Order ID you specified in the HTTPS request method.

    iOS Pushed Card
Which of the following attributes can be seen on the SalesOrder card?
×

Congratulations! You can now push cards to your Mobile Device effortlessly.


Next Steps

Back to top