ballerinax/bing.autosuggest Ballerina library



This is a generated connector for Bing Autosuggest API v1 OpenAPI specification. The Autosuggest API lets partners send a partial search query to Bing and get back a list of suggested queries that other users have searched on. In addition to including searches that other users have made, the list may include suggestions based on user intent. For example, if the query string is weather in Lo, the list will include relevant weather suggestions.

This module supports Bing Autosuggest API v1.


Before using this connector in your Ballerina application, complete the following:


To use the Bing Autosuggest connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

Import the ballerinax/bing.autosuggest module into the Ballerina project.

import ballerinax/bing.autosuggest;

Step 2: Create a new connector instance

You can now make the connection configuration using Ocp-Apim-Subscription-Key.

You can do this step in two ways. You can use any one of this.

  • Option 1 : Configure API Keys in ballerina file directly.

    uggest:ApiKeysConfig apiKeyConfig = {
    ubscriptionKey: "<Subscription Key>"
    uggest:Client myClient = check new Client(apiKeyConfig, serviceUrl);
  • Option 2 : Configure API Keys in Config.toml file and configure it in ballerina file, using configurables.

    1. Set up API Keys in Config.toml as shown below.
    ocpApimSubscriptionKey = "<AZURE_API_KEY>"
    subscriptionKey = "<Subscription Key>"
    1. Configure the client in ballerina file as shown below.
    configurable ApiKeysConfig & readonly apiKeyConfig = ?;
    autosuggest:Client myClient = check new Client(apiKeyConfig, serviceUrl);

Step 3: Invoke connector operation

  1. Now you can use the operations available within the connector. Note that they are in the form of remote operations.

    Following operation provides suggestions for a given query or partial query.

    public function main() returns error? {
        autosuggest:SentimentResponse res = check baseClient->sentiment(query);
  2. Use bal run command to compile and run the Ballerina program.


import ballerinax/bing.autosuggest;Copy


Released date: about 1 year ago

Version: 1.5.1

License: Apache-2.0


Platform: any

Ballerina version: 2201.4.1

GraalVM compatible: Yes

Pull count

Total: 0

Current verison: 0

Weekly downloads

Source repository


IT Operations/Cloud Services




Other versions

See more...