apim-apps icon indicating copy to clipboard operation
apim-apps copied to clipboard

Publisher Try Out: Add “Copy cURL” exactly like DevPortal

Open Sanjaya-Samudra opened this issue 1 month ago • 10 comments

Summary

  • Adds the “Copy cURL” option in Publisher’s Try Out console with the same placement and behavior as the Developer Portal.
  • Implementation uses Swagger UI’s built-in request snippets so the cURL and copy icon appear inside each operation after Execute.

Changes

  • Publisher: SwaggerUI.jsk
    • Enable Swagger UI request snippets ( requestSnippetsEnabled: true ).
    • Preserve existing requestInterceptor logic for final URL normalization and auth headers.
  • No other files changed.

Backward compatibility

  • No breaking UI changes; Try Out behavior unchanged except exposing existing curl snippet UI.
  • No backend changes.

Checklist

  • [✅] Matches Dev Portal placement and behavior
  • [✅] Lint/build pass locally
  • [✅] No API or backend changes
  • [✅] Minimal surface area

Sanjaya-Samudra avatar Oct 31 '25 15:10 Sanjaya-Samudra

Hi team, I’ve aligned the Publisher Try Out console with the Developer Portal by enabling Swagger UI’s built-in request snippets so the cURL + copy icon appears inside each operation (same placement/behavior as Dev Portal).

I couldn’t fully test this end-to-end on my local APIM instance right now. Could you please verify on your environment by executing any operation in Publisher Try Out and checking that the cURL block with copy appears inside the operation (like Dev Portal)? If anything needs adjusting, I’ll address it quickly and complete whatever’s missing.

Thank you.

Sanjaya-Samudra avatar Oct 31 '25 15:10 Sanjaya-Samudra

Hi @Sanjaya-Samudra, what is the issue you are encountering locally? Were you able to successfully build the apim-apps repo and product-apim repos?

Regarding the fix you have added, I don't see requestSnippetsEnabled property being available in the SwaggerUI.jsx of the devportal as well. So how can we make sure this will fix the issue in Publisher Try out?

Shall we try to check if this works by following the steps in comment [1]?

[1] https://github.com/wso2/api-manager/issues/3713#issuecomment-3354873338

tharikaGitHub avatar Oct 31 '25 16:10 tharikaGitHub

As you can see here, there is no copy button, but 3 separate tabs like below with your fix. It would be better to correctly set it up and test locally.

Screenshot 2025-10-31 at 21 54 05

tharikaGitHub avatar Oct 31 '25 16:10 tharikaGitHub

Hi @Sanjaya-Samudra, what is the issue you are encountering locally? Were you able to successfully build the apim-apps repo and product-apim repos?

Regarding the fix you have added, I don't see requestSnippetsEnabled property being available in the SwaggerUI.jsx of the devportal as well. So how can we make sure this will fix the issue in Publisher Try out?

Shall we try to check if this works by following the steps in comment [1]?

[1] wso2/api-manager#3713 (comment)

The build is successful locally on my computer, but the thing is when I launch it it just keep reloading endlessly and no UI is rendered in my frontend at all. All servers and everything I have done.

Then I have created a sym link path as you suggested and it was the same as previous no frontend UI is visible for me. When run it keeps reloading endlessly without anything rendered on the frontend. Waited so many hours looking at it but it never loads for me.

I'll check on the code and get back to you. I thought it was something like an appearance issue. Because by default it renders for devPortal I thought some version issue might cause this, let me dive more deep and solve it carefully this time.

I love to test it locally and push it, but I couldn't set it up for this, I have tried different different ways😢.

Sanjaya-Samudra avatar Oct 31 '25 16:10 Sanjaya-Samudra

Hi @Sanjaya-Samudra,

Once you start the pack, and try to access the publisher portal, can you right click on the browser window and click on inspect to check whether there are any console logs showing errors? Can you let me know what the errors are?

Also what is the java version, maven version and node version you have used to build the apim-apps repo? You can only change the carbon.apimgt.ui.version element to the SNAPSHOT version you have built the apim-apps repo with and keep the other versions unchanged to test your fix. Then you can build the all-in-one-apim to obtain the pack.

Let's try first without adding any symlinks.

tharikaGitHub avatar Oct 31 '25 17:10 tharikaGitHub

Hi @Sanjaya-Samudra,

Once you start the pack, and try to access the publisher portal, can you right click on the browser window and click on inspect to check whether there are any console logs showing errors? Can you let me know what the errors are?

Also what is the java version, maven version and node version you have used to build the apim-apps repo? You can only change the carbon.apimgt.ui.version element to the SNAPSHOT version you have built the apim-apps repo with and keep the other versions unchanged to test your fix. Then you can build the all-in-one-apim to obtain the pack.

Let's try first without adding any symlinks.

Sure I'll show you the corresponding output.

Sanjaya-Samudra avatar Oct 31 '25 17:10 Sanjaya-Samudra

Hi @Sanjaya-Samudra,

Once you start the pack, and try to access the publisher portal, can you right click on the browser window and click on inspect to check whether there are any console logs showing errors? Can you let me know what the errors are?

Also what is the java version, maven version and node version you have used to build the apim-apps repo? You can only change the carbon.apimgt.ui.version element to the SNAPSHOT version you have built the apim-apps repo with and keep the other versions unchanged to test your fix. Then you can build the all-in-one-apim to obtain the pack.

Let's try first without adding any symlinks.

I have both java 8 and 11. Tried with java 8 but now switched with 11. Maven as mentioned I have the version 3.9.11 Node version v22.20.0

Tried again but still facing the same issue, nothing found in console, and UI is empty too. Backend server works fine as well. I don't see any issue, but it is not loading. It says like this,

image

Sanjaya-Samudra avatar Oct 31 '25 19:10 Sanjaya-Samudra

Hi @Sanjaya-Samudra,

After building the product-apim repo with the carbon.apimgt.ui.version version changed, shall we try the behaviour without using npm start command? The issue might be because you have used npm start.

tharikaGitHub avatar Nov 03 '25 06:11 tharikaGitHub

Hi @Sanjaya-Samudra,

After building the product-apim repo with the carbon.apimgt.ui.version version changed, shall we try the behaviour without using npm start command? The issue might be because you have used npm start.

Yeah, I'll try again.

Sanjaya-Samudra avatar Nov 03 '25 06:11 Sanjaya-Samudra