Google URL Shortener

Google URL Shortener

Google URL Shortener

Asset Version: 1.0.0
  • Version 1.0.0
Last Published: Apr 24, 2017 By: Kony Team
113 1 0 12
The Google URL Shortener Data Adapter uses Google's URL Shortener service that takes long URLs and squeezes them into fewer characters to makes a link that is easier to share, tweet, or email to friends.

Requirements

  • Kony Fabric
 

Features

  • Ready-to-use adapter and simple to import
  • Easy to obtain short URLs from the long URLs shared by your application and vice-a-versa
  • Easy to attain details through simple interaction directly from MobileFabric.

Prerequisites

  • Kony Fabric v8

The Google URL Shortener is an official Google service that takes long URLs and reduces them into fewer characters to make shorter links and share them easily.

The Google URL Shortener is a ready to use data adapter, which is easy to import into your application using MobileFabric.

Here is a use case that describes the use of Google URL Shortener Data Adapter.

Use Case

Consider the use case for an application sharing a very long url, and the built in adapter feature produces a short URL that is easy to share:

  • Get short URL for a specified long URL
  • Get long URL for a specified short URL.

In the above use cases, you can develop the user interface and functionality of the mobile app using Kony Visualizer. To fetch, you can use MobileFabric with Google URL Shortener Data Adapter. In the MobileFabric console, you can create an integration service with the Google URL Shortener Data Adapter and create operations with the following APIs:

  1. urlshortenerurlinsert: Obtains short URL using URL shortener from a long URL.
  2. urlshortenerurlget: Obtains long URL using URL shortener from a short URL.

Integrate your mobile app with service created using Google URL Shortener Data Adapter.

The following sections help you use the Google URL Shortener Data Adapter component:

Prerequisites

Before you start using the Google URL Shortener Data Adapter, ensure you have the following:

  1. An app created in your Google Developers account
  2. apikey issued by Google Developers site when you created an app
  3. A Kony account
  4. Kony MobileFabric 7.3

Importing Google URL Shortener Data Adapter

You can import Google URL Shortener Data Adapter into MobileFabric directly from the Kony Marketplace website or by importing the data adapter zip file.

To import the data adapter zip file, do the following:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
    amadeus_api_page.png
  3. Click the Customer Data Adapters tab. The Custom Data Adapter page appears.
    amadeus_cda_import.png
  4. Click Import. The Import Data Adapter dialog appears.
    amadeus_import_da.png
  5. Click IMPORT FROM KONY MARKETPLACE. The Import Data Adapter from Kony Marketplace dialog appears with a list of available data adapters.
  6. Click Import. The Google URL Shortener data adapter is listed on the Custom Data Adapters page.
    googleurlshortener_imported.png

To import the data adapter zip file, do the following:

  1. Perform steps 1 through 4 in the above procedure
  2. Drag the component zip file into the Drag a Data Adapter box.

    Or

    Click browse. The Open dialog appears.

    Navigate to the location where you downloaded the component (zip file) on your computer, select the component, and click Open. The Import Data Adapter dialog shows the selected component.

    Note:

    Click Remove if the selected component is not the one that you want to import.

Creating an Integration Service with Google URL

After you import Google URL Shortener Data Adapter into MobileFabric, you must create an integration service with service type as Google URL Shortener to connect with your Google account.

To create an integration service with Google URL Shortener, do the following:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration tab opens with a list of existing integration services.
  4. Click CONFIGURE NEW. The Service Definition tab opens.
  5. In the Name box, type a unique name for your service.
  6. From the Service Type list, select Google URL Shortener.
    Note:

    The Google URL Shortener is listed only after you import the Google URL Shortener Data Adapter into MobileFabric.

  7. In the apiKey box, type the access key provided by the Google Developer Site.
    googleurlshortener_integ.png
  8. Click Save.

If the details provided are valid, the MobileFabric service connects to your Google developer and allows you to make the API calls.

Refer to Integration Services for more information on creating and using integration services.

Creating an Operation

To make any API call in the MobileFabric console, you must create an operation for the respective API and then execute the operation. Executing an operation involves making the API call and displaying the response. For more information, see Executing an Operation.

This section provides steps to create an operation for the getLocation Key API.

Steps to create an operation for the getLocation Key API

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration page appears with a list of existing integration services.
  4. From the list of integration services, select the integration service that you have created with service type as Google URL Shortener. The Service Definition tab of the selected integration service opens by default.
  5. Click the Operations List tab. The Operations List tab opens.
  6. Click the context menu arrow to expand the Please Select list. The Google URL Shortener is displayed.
  7. Click the plus icon to expand the Google URL Shortener list.
  8. Click the plus icon to expand the Services list, and select urlshortenerurlinsert and urlshortenerurlget.
    googleurlshortener_op.png
  9. Click ADD OPERATION. The urlshortenerurlinsert and urlshortenerurlget operation is listed in the Configured Operations section.
    googleurlshortener_op_add.png
Note:

You can follow the same steps to create operations for other methods, but ensure that you select the required API.

You can create multiple operations with required APIs and save them in the Configured Operations section. You can then execute the operations whenever required.

Executing an Operation

Executing an operation involves making the API call by setting the necessary parameters and displaying the response. The procedure to execute any operation is same, but the request parameters of the APIs vary. For more information on request parameters of each API, refer Google Develop API Catalog.

This section provides steps to execute the urlshortenerurlinsert operation (explained in Creating an Operation).

Steps to execute the urlshortenerurlinsert operation:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration tab opens with a list of existing integration services.
  4. From the list of integration services, select the integration service that you have created with service type as Google URL Shortener. The Service Definition tab of the selected integration service opens by default.
  5. Perform steps from one through five in Creating an Operation to access the Configured Operations section.
  6. Under the Configured Operations section, click the urlshortenerurlinsert operation. The urlshortenerurlinsert tab opens with the Request Input sub-tab opened by default.
  7. The Name box displays a default operation name. You can change the name, if required.
  8. On the Request Input tab, in the Body section, for the following parameters, specify the values in the respective boxes under the Test Value column.
    • alt: JSON by default.
    • fields: The parameter takes strings as input and returns additional values.
    • oauth_token: Oauth token.
    • prettyPrint: The parameter takes a Boolean value.
    • longUrl: URL that needs to be converted to Short URL.
    • projection: Takes string and returns additional information. The parameter accepts only the following values:

      "ANALYTICS_CLICKS" - Returns only click counts.

      "ANALYTICS_TOP_STRINGS" - Returns only top string counts.

      "FULL" - Returns the creation timestamp and all available analytics.

  9. Click SAVE AND FETCH RESPONSE.
    googleurlshortener_params.png
  10. The Output Result dialog appears with the response. Otherwise, the Output Result shows an error.
    googleurlshortener_out_resp.png