Ask a Question

Api hostnames wIth WWW

almogc
Occasional Visitor

Api hostnames wIth WWW

I'm trying to understand if www.something.com is a valid api hostname or it doesn't ,can you please help me with explanation.
in continuous to this article: https://swagger.io/docs/specification/2-0/api-host-and-base-path/#:~:text=host%20is%20the%20domain%2...

1 REPLY 1
HKosova
SmartBear Alumni (Retired)

Yes, "www.example.com" is a valid hostname, just like "api.example.com" and "subdomain.example.com". The "www" prefix is just a subdomain.

An OpenAPI 2.0 definition with this hostname could look like this:

swagger: '2.0'
host: www.example.com
schemes: [https]
basePath: /api
...

OpenAPI 3.0 version:

openapi: 3.0.0
servers:
  - url: https://www.example.com/api
...

 


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: