undefined
undefined

Getting Started

Lets start by creating an account here. Already have an account? Login here.

Sign up

1. Please enter your first name, last name followed by your email and check the "I am not robot" box before clicking the submit button. alt text

2.. You should see GREEN checked icon for both of the service account creation. Now click on the proceed button. alt text

3. You should get status ok for both of the service account creation. Click on close and check your email to get the temporary password. alt text

Login

1. Check your email to get the temporary password. Copy the password to clipboard. alt text

2. Now go to service exchange site page and click on sign in button. alt text

3. Please enter your email and the temporary password. To change the temporary password click on change password. Skip step 3 to 6 if you wish to keep using the temporary password. alt text

4. Please enter your email to receive the link to reset your password. alt text

5. Check your email for the reset password link. alt text

6. Click on the Reset Password button in the reset password link to change your temporary password. alt text

7. Please enter your new password and click on submit button. alt text

Service Exchange Platform

How to Subscribe to API

You have to subscribe to an published API before using it in your applications. Subscription to an API enables you to receive access tokens and be authenticated to invoke the API.

TM Service Exchange platform offers varierty of API stores from several providers. You can browse through the API store and view the API available. The list of API store available can be found at https://store.oip.tm.com.my/stores/.

In this tutorial we will be using the APIs in the service hub store. Visit https://store.oip.tm.com.my/stores/ and click on SERVICE HUB store.

alt text

The SERVICE HUB will contain APIs from 3rd party service providers.

alt text

As an example we will demonstrate the use of Weather-API using service exchange platform. All the API will be used in the same way as desribed here.

1. Sign in to the TM API Store https://store.oip.tm.com.my/apimanager/store/site/pages/login.jag and go to SERVICE HUB. In the search bar search for weather to get weather API.

alt text

2. click on an API (e.g., Weather-API 1.0) to open it. You will see a page mentioning details of weather API as show below:

alt text

3. Note the subscription options for the REST API.

alt text

4. Click the Applications menu and click Add Application to create a new application.

alt text

5. Enter the name as TestApp and select the per token quota as 50PerMin for the application and click Add.

alt text

6. Click APIs and click on the Weather-API to view the API's subscription options.

7. Select the application that you just created, a tier, and click Subscribe.

alt text

8. Click the View Subscriptions button when prompted. The Subscriptions tab will open.

9. Click the Production Keys tab and click Generate Keys to create an application access token. You can use this token to invoke all APIs that you subscribe to using the same application.

alt text

10. Install cURL if it is not there in your environment.

11. Open the command line and execute the cURL command on the right side of the screen:

curl -k -H "Authorization: Bearer <access_token>" -v '<api_url><payload>'

Be sure to replace the placeholders as follows:

alt text

Then copy the Access token

alt text

alt text

Troubleshooting

If you get an error that states "Invalid Credentials", carryout the following steps to overcome the error.

You have subscribed to an API and invoked it. To unsubscribe from an API, click the Applications menu and click View next to the application used for the subscription. Go to the Subscriptions tab, locate the API, and click the Unsubscribe link associated with it.

alt text

alt text

How to Use Integrated API Console

Swagger is a 100% open source, standard, language-agnostic specification and a complete framework for describing, producing, consuming, and visualizing RESTful APIs, without the need of a proxy or third-party services. Swagger allows consumers to understand the capabilities of a remote service without accessing its source code and interacts with the service with a minimal amount of implementation logic. Swagger helps describe a service in the same way that interfaces describe lower-level programming code.

The Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS that dynamically generate documentation from a Swagger-compliant API. Swagger-compliant APIs give you interactive documentation, client SDK generation and more discoverability. The Swagger UI has JSON code and its UI facilitates easier code indentation, keyword highlighting, and shows syntax errors on the fly. You can add resource parameters, summaries, and descriptions to your APIs using the Swagger UI.

The examples here use the Weather-API REST API, which is created in the section Create and Publish an API.

1. Sign in to the TM API Store and click an API (e.g., Weather-API). https://store.oip.tm.com.my/apimanager/store/apis/

2. Subscribe to the API (e.g., Weather-API) using the default application and an available tier.

alt text

3. Click on the Applications menu and open the default application which you used to subscribe to the API. Click the Production Keys tab and click Generate keys to generate a production key.

alt text

4. Click on the APIs menu and then click on the API that you want to invoke. When the API opens, go to its API Console tab.

alt text

5. Expand the GET method by clicking on it, provide the required parameters and click Try it Out. For example,

q London,uk
appid b6907d289e10d714a6e88b30761fae22
Authorization The API console is automatically populated by the access token that you generated in step 3 after subscribing to the API.The token is prefixed by the string "Bearer" as per the OAuth bearer token profile. OAuth security is enforced on all published APIs. If the application key is invalid, you get a 401 Unauthorized response in return.
Base URL This appears at the bottom of the console. Using the base URL and the parameters, the system creates the API URL in the form https://api.oip.tm.com.my/{context}/version/resource/{backend_service}

Where

alt text

Note the response for the API invocation. It will return the weather in London.

alt text

How to interact with IoT devices via Service Creation Platform

1. Go to https://store.oip.tm.com.my/stores/ and click on the Telekom Malaysia Research and Development store. You will see a page like shown below in the Image. alt text

Select the service creation platform API.

2. Subscribe to the API by clicking the subscribe button. Please note that you have to select the application first from the dropdown menu and selecting the tier also.

alt text

3 To see the list of application that have been created under your account click on the application tab on the left.

alt text

4. To see what APIs the particular application has been used to subscribe click on the view button in the list of application shown. You will see the list APIS that has been subscribed using particular application.

alt text

5. Click the Production Keys tab and click Generate Keys to create an application access token. You can use this token to invoke all APIs that you subscribe to using the same application.

alt text

6. Click on the API console tab after you have subscribed to the API and generated the access token. This will list down all the API that you can use. alt text

7. To use the first API which provides you the token to use service creation platform you need to provide the username and password in JSON format as shown.

{
"username" : "demo@mmu.edu.my"
"password" : "Demo_123"
}

Enter the above information in the payload box.

alt text

8. After entering the JSON information in the payload box click the try it out button. You should get the access token in the response body. alt text

9. The next API is used to get timeseries data keys. You need to enter three information entity type, entityid and X-Authorization as shown. X-Authorization is the access token you received in the previous API.

X-Authorization : Bearer <Your access token>

entityType can be:  TENANT, CUSTOMER, USER, RULE, PLUGIN, DASHBOARD, ASSET, DEVICE, ALARM

entityID is unique id of the device that you will get from service creation platform dashboard.

alt text

10. Enter all the information identified in the previous step as shown in the figure.

alt text

11. Click on try it out button and you will get all the keys of the timeseries data associated with particular entity.

alt text

12. The following API provides the data based on the keys that are obtained in the previous step. Enter all the information in the box plus the keys you want the data. For example we want data on Temperature and humidity so will enter in the key box Temperature,humidity as shown in figure below.
alt text

13. On clicking try it out button we will get the data of the keys we have entered. alt text

14. The following API gives the attributes keys associated with particular device. Enter all the information in the box as shown. alt text

15. You will get the keys associated with the device attributes when you hit the try it out button. alt text

16. After you have the attribute key you can get the attribute value by choosing the key just as you did for time series data. For example we want attribute data identified by key named "model". So we enter the "model" in the key box.

alt text

17. When you hit try it out you will receive the data. alt text

18. Issue a control command via Remote Procedure Call (RPC) to your device. Your device is required to subscribe to the topic "v1/devices/me/rpc/request/+" to receive the command.

alt text

19. Response code should be 200 indicating that the command is successfully sent to the Service Creation Platform. Your device should receive the command then. alt text !

Data Visualization

If you are interested to design your own frontend (UI) and backend (BE) integrating with our SEP via API calls, we have make our sample codes available here.

API Service Provider

How to publish an API

1. Go to the publisher page and login as the administrator. Click here alt text

2. Click on the ADD NEW API button to add new API. alt text

3. Click on Design a New REST API to expand the window and click on Start Creating button. alt text

4. Fill up the general details and add URL Pattern (i.e: /TestPattern) in the API Definition. Check the GET checkbox (assuming the backend service offering HTTP GET method) and then click on Add button. alt text

5. Click on the created URL Pattern to add parameters. alt text

6. Enter parameter name as PhoneNumber and click on add parameter button. alt text

7. Once the parameter is added, click on Description, Paramater Type and Data Type fields to configure the values accordingly. alt text

8. Click on the Required field and change the value to True. alt text

9. Click on Produces field and type in application/xml. Then, click on Consumes field and type in application/json. alt text

10. Click on next button to proceed to Implement tab. alt text

11. Click on Managed API and add the following URL "http://ws.cdyne.com/phoneverify/phoneverify.asmx" to Production Endpoint and Sandbox Endpoint. Save and click Next to proceed to the Manage tab. alt text

12. Fill up the configurations and throttling settings as displayed in the picture. Click Save & Publish. alt text

13. You should see the following notifications upon successful publish of your API. alt text

Dynamic Endpoint

1. If you happen to have multiple backend endpoints in your system and would like to locate it in one single APIs service, please select Dynamic Endpoint in Endpoint Type of Implement tab. alt text

2. Click Check to select a message mediation policy to be executed in the message flow to enable message mediation. alt text

3. Please modify the below XML script, i.e. Path to Resouce 1 mapped to the resource path that you have configured in Design tab, 1st URL mapped to your endpoint URL and resource to endpoint URL's resource. This permits constructing the service_ep property dynamically and assigned the value of this property to the To header.

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="default-endpoint-seq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <switch source="get-property('To')">
        <case regex=".*/<Path to Resource 1>">
            <property name="service_ep" value="http://<1st URL>/<resource>"/>
        </case>
        <case regex=".*/<Path to Resource 2>">
            <property name="service_ep" value="http://<2nd URL>/<resource>"/>
        </case>
        <default>
            <property name="service_ep" value="http://<3rd URL>/<resource>"/>
        </default>
    </switch>
    <header name="To" expression="get-property('service_ep')"></header>
    <property expression="get-property('service_ep')" name="ENDPOINT_ADDRESS"></property>
</sequence>

4. Select this XML script and click Upload In Flow. alt text

5. Make sure that In Flow has been set to default-endpoint-seq as API specific mediation policies. alt text

6. Click Save & Publish and you are done.

Dynamic Endpoint with Sandbox and Production Endpoints

1. If you would like to have dynamic endpoints supporting traffic reroute to your sandbox and production endpoints separately, you can the use following XML script.

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="default-endpoint-seq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
        <then>
            <switch source="get-property('To')">
                <case regex=".*/<Path to Resource 1>">
                    <property name="service_ep" value="http://<1st Production URL>/<resource>"/>
                </case>
                <case regex=".*/<Path to Resource 2>">
                    <property name="service_ep" value="http://<2nd Production URL>/<resource>"/>
                </case>
                <default>
                    <property name="service_ep" value="http://<3rd Production URL>/<resource>"/>
                </default>
             </switch>
             <header name="To" expression="get-property('service_ep')"></header>
             <property expression="get-property('service_ep')" name="ENDPOINT_ADDRESS"></property>
        </then>
        <else>
            <switch source="get-property('To')">
                <case regex=".*/<Path to Resource 1>">
                    <property name="service_ep" value="http://<1st Sandbox URL>/<resource>"/>
                </case>
                <case regex=".*/<Path to Resource 2>">
                    <property name="service_ep" value="http://<2nd Sandbox URL>/<resource>"/>
                </case>
                <default>
                    <property name="service_ep" value="http://<3rd Sandbox URL>/<resource>"/>
                </default>
             </switch>
             <header name="To" expression="get-property('service_ep')"></header>
             <property expression="get-property('service_ep')" name="ENDPOINT_ADDRESS"></property>
        </else>
    </filter>
</sequence>

2. Apply the similar steps as previous Dynamic Endpoint section.

Contact Us

If you are facing any technical issue while using the OIP platform, please contact us at ''oip@tmrnd.com.my''