vania-janet/multiturn-rag-retrieval-data huggingface dataset:
[Enter new password](https://cloud.ibm.com/docs-content/v1/content/78bb71851d95d7580503eb9ba10cf3ae31490ade/apiconnect/tutorials/images/23-password.png)
4. Now that you've set your password, let's explore the developer portal, starting with Home at the top of the page.
![Home menu](https://cloud.ibm.com/docs-content/v1/content/78bb71851d95d7580503eb9ba10cf3ae31490ade/apiconnect/tutorials/images/24-pwsaved.png)





 Tab Description 

 Home The Home page is the welcome page to your developer portal. You can [customize the page](https://cloud.ibm.com/docs/apiconnect/tutorials?topic=apiconnect-tut_custom_dev_portal) to suit your needs. 
 Getting Started The Getting started page is used to instruct developers how to get started using your developer portal. 
 API Products The API Products page is used by developers to explore and subscribe to the APIs that are available on your portal. 
 Apps The Apps page displays the applications that are using your APIs. 
 Blogs The Blogs page is where you can create and display blog posts about your APIs. 
 Forums The Forums page is where developers can have discussions and post questions about your APIs. 
 Support The Support page is where you can direct developers on how they can receive support on your APIs. For example, you can refer them to your forums and FAQs. You can also provide a link that allows them to open a support ticket if needed. 



Note: On the API Products page, you can select one of the products to view the Product page for an API and the available plans. It enables developers to subscribe to and view the API details.

!
{"brokers":["kafka-0.mh-svc1-0000.eu-de.containers.appdomain.cloud:9093","kafka-1.mh-sv2.eu-de.containers.appdomain.cloud:9093","kafka-2.mh-sv3.eu-de.containers.appdomain.cloud:9093"],"topic":"la-dallas-topic","user":"token","password":"0000000_aaaa00000_0bbb00000ccc"}

Then pass the file on the cURL command as follows:

curl --request POST https://api.eu-gb.logging.cloud.ibm.com/v1/config/stream -H "content-type: application/json" -H "servicekey: 0000000aaaa000000bbb00000ccc" -d @data.json
{"brokers":["kafka-0.mh-svc1-0000.eu-de.containers.appdomain.cloud:9093","kafka-1.mh-sv2.eu-de.containers.appdomain.cloud:9093","kafka-2.mh-sv3.eu-de.containers.appdomain.cloud:9093"],"topic":"at-dallas-topic","user":"token","password":"0000000_aaaa00000_0bbb00000ccc"}

Then pass the file on the cURL command as follows:

curl --request POST https://api.eu-gb.logging.cloud.ibm.com/v1/config/stream -H "content-type: application/json" -H "servicekey: 0000000aaaa000000bbb00000ccc" -d @data.json
For example, specify "broker-0-abcdabcdabcdabcd.kafka.svc01.us-south.eventstreams.cloud.ibm.com:9093", "broker-1-abcdabcdabcdabcd.kafka.svc01.us-south.eventstreams.cloud.ibm.com:9093" for the message broker hosts for the myeventstream-key service instance.
2. Click Configure to configure access to the message broker. To authenticate from Code Engine to your Kafka or Event Streams instance, you need to provide a message broker access secret.



* You can create a new secret, choose an existing secret, or if credentials are not required to access the message brokers, then choose None.
* To create a secret, click Create. Provide a name for the secret, and values for username and password. The values for username and password must match the values in the service credentials for the Kafka or Event Streams instance. For example, the value for username is the value of user that is listed in the details of the service credentials in the Event Streams service instance. The value for password is the value of apikey that is listed in the details of the service credentials in the Event Streams service instance.
* For this example, use the existing kafka-subscription-secret secret that was previously created.



3. Specify the name of existing topics for the message queues. For example, kafka-topic1. To obtain information about existing topics for your service instance, go to your service instance in the Event Streams console and view Topics.
4. (Optional) Specify a consumer group. Consumers of Kafka messages can be grouped into [consumer groups](https://cloud.ibm.com/docs/EventStreams?topic=EventStreams-consuming_messagesconsumer_groups). If you are using consumer groups, the topic configuration controls the message flow to consumers in the consumer group. Whenever a consumer is added to or removed from a consumer group, the message flow from that topic might change. This action can cause existing consumers to no longer receive messages from that topic.
For more information on logging in to the toolkit, see [Setting up the toolkit for V10 Reserved](https://www.ibm.com/support/knowledgecenter/SSMNED_v10cloud/com.ibm.apic.toolkit.doc/ri_toolkit.htmlri_tk_login) in the extended V10 Reserved documentation.





 Calling an API Connect API programmatically in V10 Reserved 

To call an API programmatically, generate an API key and then use it to generate an IBM Cloud IAM access token. You can use the generated token for authentication in your API calls.



 Obtain an IBM Cloud API key 

To obtain an IBM Cloud API Key, complete the following steps.



1. Visit [IBM Cloud API Keys](https://cloud.ibm.com/iam/apikeys).
2. Click Create an IBM Cloud API key.
3. In the "Create API key" dialog box, provide a name and description for the key, and then click Create.
4. Important In the "API key successfully created" message box, click Download to save a copy of the key as a file called apikey.json.



The API key does not expire; however, after you close the message box, you cannot access the key. If you lose the key or failed to copy it, you must obtain a new API key.



 API key best practices 

API keys are used as the method of authentication to your service, so they must be kept secure. The following best practices help you maintain a secure API key and reduce the chance of publicly exposing credentials that compromise your application.



* Use an API key with the role that is appropriate for the function that you are using. When you create an application, consider using an API key with the role Reader for all calls to GET API methods. The Reader role can't perform any destructive or additive functions to the service instance.
* Do not embed the API key directly in code. API keys that are embedded in code might be exposed to your users. Instead of embedding the API keys in your application code, consider storing them either in environment variables or in files outside of your source code control system.
Go to the Dashboard of API Connect.
2. Select Drafts > APIs.
3. Click the REST API that you imported.
4. Select the Assemble tab, and select Create assembly to add the proxy policy.
5. Drag the Proxy policy to the new empty policy to enable it.
6. Paste the URL for your API that you copied from the public Endpoints section of IBM Integration Bus on Cloud.
7. If you enabled Basic Authentication for your REST API, enter the username and password that were generated in IBM Integration Bus on Cloud.
8. Save the API settings.



3. Test the API.



1. In the Assemble tab of your API, select the Test button ![Test button](https://cloud.ibm.com/docs-content/v1/content/78bb71851d95d7580503eb9ba10cf3ae31490ade/apiconnect/images/a_play_button.jpg).
2. Select Republish product.
3. Select the Operation.
4. Enter the required parameters.
5. Select Invoke.
6. Verify that you receive the expected response from the API.





When the API definition is imported and integrated, you can manage and govern the APIs as you with any other REST API definition. For more information about the APIs, see [Managing APIs](https://cloud.ibm.com/docs/apiconnect?topic=apiconnect-managing_apis).







 Publishing APIs created with IBM App Connect Professional in IBM API Connect 

With this tutorial, you can publish and manage REST APIs that you create with IBM App Connect Professional with IBM® API Connect for IBM Cloud®.



 Prerequisites 

You need valid accounts for IBM App Connect Professional on Cloud and for API Connect to complete this tutorial. Ensure that your REST API file conforms to version 2.0 of the OpenAPI specification. The format of the file can be JSON or YAML.
[Get credentials using the IBM Cloud CLI](https://cloud.ibm.com/docs/EventStreams?topic=EventStreams-connectingconnect_enterprise_external_cli) and make note of the api key and broker URL values.







 Step 3. Configure the connection in Monitoring to Event Streams 

To configure IBM Cloud Monitoring metric data streaming, do the following:



1. Launch the web UI as a user with administrator authority. For more information on how to launch the Web UI, see [Navigating to the Web UI](https://cloud.ibm.com/docs/monitoring?topic=monitoring-launchlaunch).
2. Click the user icon. This is the icon with the initials of the logged on user. Then click Settings.
3. Select Metric Data Streaming.
4. Click Add Integration. The New Metric Streaming Integration panel is displayed.

Zoom

![Metric Streaming Integration panel](https://cloud.ibm.com/docs-content/v1/content/220cdcbf6f4421bd7fee83fd1028048dba3f16c8/monitoring/images/streaming1.png)

Metrics Streaming integration panel
5. Specify the following information:

Integration Name
: The name of the streaming configuration.

Topic
: The name of the Kafka topic to receive the metrics.

Brokers
: A list of Kafka brokers separated by commas, for example kafka-2.mh-svc.eu-de.containers.appdomain.cloud:9093,kafka-1.mh-svc.eu-de.containers.appdomain.cloud:9093,kafka-0.mh-svc.eu-de.containers.appdomain.cloud:9093. Notice that you must not enclose within " the URLs.

TLS
: The Transport Layer Security (TLS) method. Enable TLS to encrypt and protect the transfer of data.

Credentials
In the Bootstrap Server URL section, enter the kafka_brokers_sasl values that are listed in the service credential.

You must enter each URL as individual entries. If you need to add additional URLs, click Add another URL to add each additional URL.
4. Enter the name of a topic.
5. Click Save.
6. A message will be displayed indicating that sample lines are sent that can be used to verify your connection.

![Verify your connection](https://cloud.ibm.com/docs-content/v1/content/f61dbc5d84bf0c89e477a05cab04c72f429e1b7a/log-analysis/images/streaming-verify.png)









 Step 4. Verify sample data can reach the topic in Event Streams 

To continue, you must verify that sample data can reach the topic in Event Streams.

To verify that sample data is streaming, you can use IBM Cloud Monitoring.



1. Check that you have an instance of Monitoring in the same region as your Event Streams instance. This instance must be configured to collect platform metrics. For more information, see [Enabling platform metrics](https://cloud.ibm.com/docs/monitoring?topic=monitoring-platform_metrics_enabling).
2. [Launch the Monitoring UI](https://cloud.ibm.com/docs/monitoring?topic=monitoring-launch).
3. In the Dashboards section, go to Dashboard templates and select the template IBM Event Streams (Enterprise).
4. Create a copy of the temnplate by clicking Create custom dashboard.
5. Edit the panel Topic bytes in per second.

![Edit panel.](https://cloud.ibm.com/docs-content/v1/content/f61dbc5d84bf0c89e477a05cab04c72f429e1b7a/log-analysis/images/streaming-topic-metric.png)
[External link icon](https://cloud.ibm.com/docs-content/v1/icons/launch-glyph.svg)](https://www.ibm.com/support/knowledgecenter/SSQP8H/iot/platform/devices/mqtt.htmlmqtt_authentication).
**For more information about API keys and tokens, see [API key connection](https://cloud.ibm.com/docs/applications/app_dev_index.htmlauthentication). Tip: You can look up the default API key and token for your Watson IoT Platform instance by using the [Watson IoT Platform dashboard ![External link icon](https://cloud.ibm.com/docs-content/v1/icons/launch-glyph.svg)](https://www.ibm.com/support/knowledgecenter/SSQP8H/iot/getting_started/external_dashboard.htmlaccess_api).





 Using HTTP APIs 

Each Watson IoT Platform organization is identified by a 6-character organization ID ({orgId}) which is required in the host name for any HTTP API call.
Tip: You can find your organization ID from the Watson IoT Platform dashboard, see [Accessing service APIs ![External link icon](https://cloud.ibm.com/docs-content/v1/icons/launch-glyph.svg)](https://www.ibm.com/support/knowledgecenter/SSQP8H/iot/getting_started/external_dashboard.htmlaccess_api).



 HTTP API URL 

Use the following API endpoint URLs to access the Watson IoT Platform APIs. The API endpoint URL consists of a Host URL and a Base URL. The base URL for each REST API is listed with the [API docs](https://cloud.ibm.com/docs/services/IoT?topic=IoT-api_overviewapi_docs), and is typically api/v0002/.



 API Host URL
SinkProvided true 24s

Events:
Type Reason Age Source Messages
Normal FinalizerUpdate 26s kafkasource-controller Updated "mykafkasubscription" finalizers







 Step 4: Testing your subscription 

Now that your Kafka event subscription, which references the kafka-receiver-app application, is created, use the kafka-sender-app to send message events to the receiver application.



1. Obtain the public URL of the destination app, kafka-sender-app by using the [ibmcloud ce app get](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-application-get) command with the --output url option to find the URL of your app.

ibmcloud ce app get -n kafka-sender-app --output url

Example output

https://kafka-sender-app.abcdabcdabc.us-south.codeengine.appdomain.cloud
2. Run the Kafka event producer app, kafka-sender-app to send events to the destination Code Engine application. Call the kafka-sender-app application with curl and specify values for the topic and the number of messages. Use the output of the ibmcloud ce app get command to find the public URL of your app. Be sure to wrap the value to curl in quotation marks to ensure that it is treated as a single string. For example,

curl "<public_URL_of_Kafka_sender_app>?topic=<your_topic_name>&num=<number_of_messages_to_produce>"

For example,

curl "https://kafka-sender-app.abcdabcdabc.us-south.codeengine.appdomain.cloud?topic=kafka-topic1&num=1"
3. View events in logs.
Download and install the [Code Engine CLI](https://cloud.ibm.com/docs/codeengine?topic=codeengine-install-cli).

ibmcloud plugin install code-engine -f
3. To use the Event Streams service for creating your Kafka instance, download and install the [Event Streams CLI](https://cloud.ibm.com/docs/cli?topic=EventStreams-cli).

ibmcloud plugin install event-streams -f
4. Log in to your IBM Cloud account and target a resource group. Target a resource group by running the following command. To get a list of your resource groups, run the ibmcloud resource groups command.

ibmcloud target -g <resource_group>







 Setting up your Kafka instance 



1. Create a service instance for Event Streams. The name of the Event Streams CLI service is messagehub. For this example, create an Event Streams service instance that is named myeventstream.

ibmcloud resource service-instance-create myeventstream messagehub lite us-south
2. Create a service key to provide credentials to your service instance.

ibmcloud resource service-key-create myeventstream-key Manager --instance-name myeventstream

Example output

Creating service key of service instance myeventstream under account <user_account>...
OK
Service key crn:v1:bluemix:public:messagehub:us-south:a/e43abfcbd191404cb17ef650e9681dd3:c0736069-3f4a-438a-b614-6846877d692d:resource-key:4c8edfdb-abcd-abcd-abcd-abcdabcdabcd was created.

Name: myeventstream-key
curl -X POST https://api.us-south.devops.cloud.ibm.com/toolchain/v2/toolchains/01234567-89ab-cdef-0123-456789abcdef/tools -H "Authorization: Bearer $TOKEN" -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{
"tool_type_id": "slack",
"parameters": {
"api_token": "{vault::my-kms-tool-integration.my-slack-webhook}",
"channel_name": "my_slack_channel_name",
"team_url": "my_slack_team_name"
}
}'

import com.ibm.cloud.continuous_delivery.cd_toolchain.v2.CdToolchain;
import com.ibm.cloud.continuous_delivery.cd_toolchain.v2.model.;
...
CdToolchain toolchainService = CdToolchain.newInstance();
HashMap<String, Object> slackParameters = new HashMap<>();
slackParameters.put("api_token", "{vault::my-kms-tool-integration.my-slack-webhook}");
slackParameters.put("channel_name", "my_slack_channel_name");
slackParameters.put("team_url", "my_slack_team_name");
CreateToolOptions createSlackToolOptions = new CreateToolOptions.Builder()
.parameters(slackParameters)
.toolchainId({toolchain_id})
.toolTypeId("slack")
.build();
Response<ToolchainToolPost> response = toolchainService.createTool(createSlackToolOptions).execute();
Calling APIs provided by V10 Reserved 

The REST APIs provided by API Connect V10 Reserved require authentication for use. To call an API interactively, you can log into the toolkit CLI with an option to generate the API key. To call an API programmatically, you can generate an API key and then exchange it for an IBM Cloud IAM Bearer token.

This requirement applies only to the APIs that are provided by API Connect. You do not need the API key for calling APIs that you imported or created. The API key is intended for use with the IBM ID and might not work with other user registries.

This topic applies only to the V10 Reserved edition of API Connect. For information on calling API Connect APIs in V5, see [Calling APIs provided by API Connect V5](https://cloud.ibm.com/docs/apiconnect?topic=apiconnect-call_apim_apis).



 Calling an API Connect API interactively in V10 Reserved 

To call APIs interactively in the V10 Reserved CLI, log in to the API Connect toolkit with the following command:

apic login --server {mgmt_endpoint_url} --sso

Follow the displayed instructions to generate an IBM Cloud API key, copy it from the IBM API Connect Reserved passcode page, and submit the API key on the command line to complete the login. The authentication lasts for the duration of your CLI session. You do not need to provide the API key with API calls during the session.

For more information on logging in to the toolkit, see [Setting up the toolkit for V10 Reserved](https://www.ibm.com/support/knowledgecenter/SSMNED_v10cloud/com.ibm.apic.toolkit.doc/ri_toolkit.htmlri_tk_login) in the extended V10 Reserved documentation.





 Calling an API Connect API programmatically in V10 Reserved 

To call an API programmatically, generate an API key and then use it to generate an IBM Cloud IAM access token. You can use the generated token for authentication in your API calls.



 Obtain an IBM Cloud API key
Copy the following JavaScript code and update the placeholder values.

const axios = require('axios');
const jwtVerify = require('jsonwebtoken').verify;

// Generate an IAM token
async function getIAMToken() {
const options = {
url: 'https://iam.cloud.ibm.com/identity/token',
method: 'POST',
header: 'Content-Type: application/x-www-form-urlencoded',
data: 'grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=API_KEY'
};

const response = await axios(options);
const responseData = response.data;
console.log("nGenerated an IAM token..");
return responseData.access_token;
}

// Get a public key to verify notifications
async function getPublicKey() {
const accessToken = await getIAMToken();

const options = {
method: 'GET',
url: '<event_notifications_endpoint_url>/destinations/<destination_id>/public_key',
headers: {
'authorization': 'Bearer ' + accessToken
}
};

const response = await axios(options);
const responseData = response.data;
console.log('nRetrieved a public key from Event Notifications..');
return responseData.public_key;
}

async function main(params) {

try {
const publicKey = await getPublicKey();

// Verify the notification data using the retrieved public key
const decodedNotification = await jwtVerify(params.__ow_body, publicKey).data.data;
Replace BOOTSTRAP_ENDPOINTS, USER, and PASSWORD with your own service credentials:

Properties props = new Properties();
props.put("bootstrap.servers", BOOTSTRAP_ENDPOINTS);
props.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username="USER" password="PASSWORD";");
props.put("security.protocol", "SASL_SSL");
props.put("sasl.mechanism", "PLAIN");
props.put("ssl.protocol", "TLSv1.2");
props.put("ssl.enabled.protocols", "TLSv1.2");
props.put("ssl.endpoint.identification.algorithm", "HTTPS");

To send messages, you also need to specify serializers for the keys and values, for example:

props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");

Then, use a KafkaProducer to send messages, where each message is represented by a ProducerRecord. Don't forget to close the KafkaProducer when you're finished. This code just sends the message but it doesn't wait to see whether the send succeeded.

Producer<String, String> producer = new KafkaProducer<>(props);
producer.send(new ProducerRecord<String, String>("T1", "key", "value"));
producer.close();

The send() method is asynchronous and returns a Future that you can use to check its completion:

Future<RecordMetadata> f = producer.send(new ProducerRecord<String, String>("T1", "key", "value"));
More detailed usage information is in the [plug-in's documentation](https://github.com/rabbitmq/rabbitmq-delayed-message-exchangeusage).





 STOMP plug-in 

The [RabbitMQ STOMP plug-in](https://www.rabbitmq.com/stomp.html), rabbitmq_stomp, supports sending [STOMP-formatted](http://stomp.github.io/) messages through RabbitMQ. The plug-in enables a port to handle STOMP traffic on your deployment, and it is TLS/SSL secured. The connection information for STOMP clients is in the stomp_ssl section of your deployment's [connection strings](https://cloud.ibm.com/docs/messages-for-rabbitmq?topic=messages-for-rabbitmq-connection-stringsthe-stomp_ssl-section).





 RabbitMQ Management plug-in 

The RabbitMQ Management plug-in, rabbitmq_management, provides access to your deployment through a web browser, rabbitmqadmin, and through the RabbitMQ API. For more information, see [Connecting with the RabbitMQ Management plug-in](https://cloud.ibm.com/docs/messages-for-rabbitmq?topic=messages-for-rabbitmq-rabbitmq-management-plugin).





 JMS plug-in 

The RabbitMQ JMS Topic Exchange plug-in, rabbitmq_jms_topic_exchange, is enabled by default for Messages for RabbitMQ deployments. This plug-in adds server-side support for the [RabbitMQ JMS client](https://github.com/rabbitmq/rabbitmq-jms-client) and supports JMS topic routing plus selection based on JMS SQL selection rules.

The RabbitMQ JMS Client is required to communicate with the plug-in. Review the [JMS Client documentation page](https://www.rabbitmq.com/jms-client.html) that is provided by RabbitMQ for more detailed information on installation and configuration, along with examples.
"https_redirect": null
}
7. Add the pool member.

First, create an API request payload using the following template:

{
  "port": 90,
"target": {
"id": "0767_5545cfb3-febc-4f09-b9ea-0aeb66074edf"
}
}

Then run the following command:

curl -s -H "Authorization: Bearer $IAM_TOKEN" -X POST -d @add_member.json "https://us-east.iaas.cloud.ibm.com/v1/load_balancers/r014-020f4f34-bb49-4699-98a7-a53384cd649d/pools/r014-0b8f4cde-4684-484b-bd3c-64f55a917328/members?version=2021-07-30&generation=2" | jq

Sample output:

{
"id": "r014-c625efe0-6f69-4ae7-a2ef-9bf33c811a2c",
"href": "https://us-east.iaas.cloud.ibm.com/v1/load_balancers/r014-020f4f34-bb49-4699-98a7-a53384cd649d/pools/r014-0b8f4cde-4684-484b-bd3c-64f55a917328/members/r014-c625efe0-6f69-4ae7-a2ef-9bf33c811a2c",
"port": 90,
"target": {
"id": "0767_5545cfb3-febc-4f09-b9ea-0aeb66074edf",