DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Managing REST APIs With Swagger [Video]

Managing REST APIs With Swagger [Video]

Swagger is an ecosystem of tools and other resources for managing REST APIs. Check out some of the features in this video.

Hod Greeley user avatar by
Hod Greeley
·
Apr. 29, 17 · Opinion
Like (3)
Save
Tweet
Share
7.44K Views

Join the DZone community and get the full member experience.

Join For Free

Couchbase incorporated Swagger into our documentation a few months ago. “Swagger” refers to an ecosystem of tools and other resources for managing REST APIs.

Core to Swagger is the Swagger specification. (The group behind Swagger donated the spec to the OpenAPI Initiative. The original site, swagger.io remains the main site for tools and such.)

Once you have the API spec defined for your endpoints, you get several valuable capabilities. My two favorite are the “live” embeddable documentation and the client libraries. Take a look at this short video for a demonstration of some of the features of Swagger.


For an example of using a Swagger JavaScript client, take a look at this blog post.

You can find the Swagger specs for the Sync Gateway public API here and the admin API here.

Here are the Sync Gateway configurations I refer to in the video. The first has the CORS configuration to allow access from swagger.io.

{
  "log": ["*"],
  "CORS": {
     "Origin":["*"],
     "Headers": ["Content-Type"]
  },
  "databases": {
    "db": {
      "server": "walrus:",
      "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } },
      "allow_empty_password": true
    }
  }
}

The second is for trying out calls through our live documentation.

{
   "log": [
      "*"
   ],
   "SSLCert": "cert.pem",
   "SSLKey": "privkey.pem",
   "CORS": {
      "Origin": ["*"],
      "Headers": ["Content-Type"]
   },
   "databases": {
      "db": {
         "server": "walrus:",
         "users": {
            "GUEST": {
               "disabled":false,
               "admin_channels": [
                  "*"
               ]
            }
         }
      }
   }
}

(Note: There’s currently a known issue with making the calls from the Couchbase documentation. Couchbase now requires access via https, in keeping with security best practices. This means the documentation also redirects using https. This means you have to set up Sync Gateway to use SSL. See the documentation here for more information.)

Postscript

Download Couchbase and Sync Gateway here. See our documentation for how to add Couchbase Lite to a project.

Check out more resources on our developer portal and follow us on Twitter @CouchbaseDev.

REST Web Protocols

Published at DZone with permission of Hod Greeley. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Explainer: Building High Performing Data Product Platform
  • Simulating and Troubleshooting StackOverflowError in Kotlin
  • Essential Mobile App Security Tips for Coders in 2023: Make Your App Unhackable
  • Build CRUD RESTful API Using Spring Boot 3, Spring Data JPA, Hibernate, and MySQL Database

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: