Yusuf Avcı
Yusuf Avcı

Reputation: 11

Error on APIM 4.0.0 service catalog listing

I deployed APIM 4.0.0 on Kubernetes. Then, I tried to use the Integration Studio with APIM. Then, I added these lines into the embedded deployment.toml file in Integration Studio.

[[service_catalog]]
apim_host = "https://xxx.xxx"
enable = true
username = "admin"
password = "admin"

After clicking export project artifacts and run, emdedded MI logged a success message.

"Successfully updated the service catalog".

Now; when I try to access the service catalog in APIM Publisher Portal, I get this error on the browser:

OOPS
Something went wrong
API Listing
Failed to construct 'URL': Invalid URL
TypeError: Failed to construct 'URL': Invalid URL
    at https://xxx.xxx/publisher/site/public/dist/ProtectedApps.8633bb016fecd98c9d94.bundle.js:1:6884
    at x (https://xxx.xxx/publisher/site/public/dist/ProtectedApps.8633bb016fecd98c9d94.bundle.js:1:7011)
    at $i (https://xxx.xxx/publisher/site/public/dist/index.7422e2feefc0de743eb6.bundle.js:81:57930)
    at vu (https://xxx.xxx/publisher/site/public/dist/index.7422e2feefc0de743eb6.bundle.js:81:104169)
    at lc (https://xxx.xxx/publisher/site/public/dist/index.7422e2feefc0de743eb6.bundle.js:81:96717)
    at uc (https://xxx.xxx/publisher/site/public/dist/index.7422e2feefc0de743eb6.bundle.js:81:96642)
    at Zu (https://xxx.xxx/publisher/site/public/dist/index.7422e2feefc0de743eb6.bundle.js:81:93672)
    at https://xxx.xxx/publisher/site/public/dist/index.7422e2feefc0de743eb6.bundle.js:81:45314
    at t.unstable_runWithPriority (https://xxx.xxx/publisher/site/public/dist/index.7422e2feefc0de743eb6.bundle.js:102:3844)
    at Ho (https://xxx.xxx/publisher/site/public/dist/index.7422e2feefc0de743eb6.bundle.js:81:45023)

    in x
    in div
    in ForwardRef
    in ForwardRef
    in div
    in ForwardRef
    in ForwardRef
    in div
    in ForwardRef
    in a
    in ForwardRef
    in ForwardRef
    in ForwardRef
    in ForwardRef
    in ForwardRef
    in ForwardRef
    in div
    in ForwardRef
    in ForwardRef
    in w
    in div
    in ForwardRef
    in ForwardRef
    in div
    in ForwardRef
    in ForwardRef
    in _
    in div
    in ForwardRef
    in ForwardRef
    in div
    in ForwardRef
    in div
    in ForwardRef
    in ForwardRef
    in div
    in ForwardRef
    in b
    in t
    in t
    in u
    in t
    in t
    in div
    in main
    in div
    in E
    in AppErrorBoundary
    in ForwardRef
    in Unknown
    in Unknown
    in Protected
    in Suspense
    in t
    in t
    in t
    in t
    in PublisherRootErrorBoundary
    in IntlProvider
    in Publisher

Upvotes: 0

Views: 770

Answers (1)

Vithursa Mahendrarajah
Vithursa Mahendrarajah

Reputation: 1224

Since there is an issue in the listing page in UI, you can use the REST APIs to delete the service from Service Catalog.

  1. Get the UUID of the service by retrieving all services, by calling GET /services REST API.
curl -k -H "Authorization: Bearer <access-token>" "https://wso2.apim.com/api/am/service-catalog/v0/services"
  1. Delete the service by calling the DELETE /services/{serviceId} REST API.
curl -k -X DELETE -H "Authorization: Bearer <access-token>" "https://wso2.apim.com/api/am/service-catalog/v0/services/{serviceUUID}"

[UPDATE]

Please refer the steps below to create token to access Service Catalog REST APIs:

  • Register an OAuth client by making the following API call:
curl --location --request POST 'https://localhost:9443/client-registration/v0.17/register' \
--header 'Authorization: Basic base64Encode(username:password)' \
--header 'Content-Type: application/json' \
--data-raw '{
  "callbackUrl":"www.google.lk",
  "clientName":"rest_api_service_catalog",
  "owner":"admin",
  "grantType":"client_credentials password refresh_token",
  "saasApp":true
  }'

It will return clientId and clientSecret of the generated OAuth application.

  • Obtain token with required scopes:

You need to get token with service_catalog:service_view scope to retrieve all the services and a token with service_catalog:service_write is required to delete the services. Hence, you can request token with these two scopes:

curl https://localhost:9443/oauth2/token -k \
-H "Authorization: Basic base64Encode(clientId:clientSercret)" \
-d "grant_type=password&username=<username>&password=<password>&scope=service_catalog:service_view service_catalog:service_write"

You can find more information about Service Catalog REST APIs and token generation in this doc.

Please note that I referred wso2.apim.com as the hostname of APIM node. Under default configurations it would be https://localhost:9443.

Upvotes: 1

Related Questions