1

I forked this repo for developing a fb chatbot which uses IBM Watson services. In the Swagger.yaml file, the username and password is passed to authenticate the request, but IBM no more uses username & password for authentication purposes instead we use IAM key & API key. How to set this up in this Swagger.yaml file? I've pasted the part of the code which uses username & password below.

swagger.yaml

operations:
                - verb: post
                  path: /PATH_NAME
              execute:
                - invoke:
                    target-url: 'https://openwhisk.ng.bluemix.net/api/v1/namespaces/' + YOUR_NAMESPACE + '/triggers/' + YOUR_SEQUENCE_NAME
                    username: YOUR_WSK_USERNAME
                    password: YOUR_WSK_PASSWORD
                    verb: keep
                    cache-response: no-cache
            - operations:
                - verb: get
                  path: /YOUR_PATH
              execute:
                - map:
                    title: map
                    inputs:
                      request:
                        schema:
                          type: string
                        variable: request.uri
                    outputs:
                      output:
                        schema:
                          type: object
                          properties:
                            uri:
                              type: string
                              name: uri
                        variable: message.body
                        content: application/json
                    actions:
                      - set: output.uri
                        from: request
                    version: 1.0.0
                - invoke:
                    title: invoke
                    timeout: 60
                    verb: POST
                    cache-response: no-cache
                    cache-ttl: 900
                    version: 1.0.0
                    target-url: 'https://openwhisk.ng.bluemix.net/api/v1/namespaces/' + YOUR_NAMESPACE + '/actions/' + YOUR_TRIGGER_NAME + 'blocking=true'
                    username: YOUR_WSK_USERNAME
                    password: YOUR_WSK_PASSWORD
                    output: whisk

I used the below command to get my WSK username & password,

bx wsk property get

I got these details back,

client cert     
Client key      
whisk auth      <<some random alpha numeric numbers here>>
whisk API host      eu-gb.functions.cloud.ibm.com
whisk API version   v1
whisk namespace     _
whisk CLI version   2019-01-16T22:06:45+00:00
whisk API build     2019-02-17T08:32:41Z
whisk API build number  whisk-build-xxxxx

I can't find out where is this WSK password or username!

Also I got this error when I tried to upload this file into Drafts>API's in API-connect.

Error

A JSON processing exception occurred while processing the HTTP request. Please see additional error messages for more details. Message: Unexpected character ('s' (code 115)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: java.io.ByteArrayInputStream@2335f3d1; line: 1, column: 2], Source: swagger.yaml, Line: 1, Column: 2

A processing exception occurred while processing the HTTP request. Please see additional error messages for more details.

0 Answers0