1

I have been using Swagger-UI to document my APIs and have been loving it, however I was wondering if in the "try it now" section (when Swagger returns the request URL, if there was a way to also show the CURL?

I was wondering if someone had devised a hack to inject this into the prebuilt Swagger-UI format (as I just generated it using a Swagger-Spec).

8
  • Take a look at stackoverflow.com/questions/30333839/… and github.com/swagger-api/swagger-js/blob/… Commented May 19, 2015 at 18:56
  • Sorry did you mean to link me to a different stackoverflow question? Commented May 19, 2015 at 20:15
  • Huh. Yeah, sorry, the copy didn't work ;) Meant - github.com/swagger-api/swagger-ui/issues/1073 Commented May 19, 2015 at 22:28
  • Is there a specific piece of code for the curl itself? I seem to recall stumbling across something in the swagger js files but can't find it Commented May 21, 2015 at 14:27
  • You mean the second link provided in the first comment? Commented May 21, 2015 at 14:35

1 Answer 1

2

The last version of swagger-ui dist bundle will show the curl commands section by default, no single change in your specification is necessary.

Sign up to request clarification or add additional context in comments.

1 Comment

In addition, one can copy-paste the full curl command from that section to a terminal or command prompt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.