Path: blob/dev/pkg/input/formats/testdata/openapi.yaml
2070 views
openapi: 3.1.01info:2title: VAmPI3description: OpenAPI v3 specs for VAmPI4version: '0.1'5servers:6- url: http://hackthebox:50007components: {}8paths:9/createdb:10get:11tags:12- db-init13summary: Creates and populates the database with dummy data14description: Creates and populates the database with dummy data15operationId: api_views.main.populate_db16responses:17'200':18description: Creates and populates the database with dummy data19content:20application/json:21schema:22type: object23properties:24message:25type: string26example: 'Database populated.'27/:28get:29tags:30- home31summary: VAmPI home32description: >-33VAmPI is a vulnerable on purpose API. It was created in order to34evaluate the efficiency of third party tools in identifying35vulnerabilities in APIs but it can also be used in learning/teaching36purposes.37operationId: api_views.main.basic38responses:39'200':40description: Home - Help41content:42application/json:43schema:44type: object45properties:46message:47type: string48example: 'VAmPI the Vulnerable API'49help:50type: string51example: 'VAmPI is a vulnerable on purpose API. It was created in order to evaluate the efficiency of third party tools in identifying vulnerabilities in APIs but it can also be used in learning/teaching purposes.'52vulnerable:53type: number54example: 155/users/v1:56get:57tags:58- users59summary: Retrieves all users60description: Displays all users with basic information61operationId: api_views.users.get_all_users62responses:63'200':64description: See basic info about all users65content:66application/json:67schema:68type: array69items:70type: object71properties:72email:73type: string74example: '[email protected]'75username:76type: string77example: 'name1'78/users/v1/_debug:79get:80tags:81- users82summary: Retrieves all details for all users83description: Displays all details for all users84operationId: api_views.users.debug85responses:86'200':87description: See all details of the users88content:89application/json:90schema:91type: array92items:93type: object94properties:95admin:96type: boolean97example: false98email:99type: string100example: '[email protected]'101password:102type: string103example: 'pass1'104username:105type: string106example: 'name1'107/users/v1/register:108post:109tags:110- users111summary: Register new user112description: Register new user113operationId: api_views.users.register_user114requestBody:115description: Username of the user116content:117application/json:118schema:119type: object120properties:121username:122type: string123example: 'John.Doe'124password:125type: string126example: 'password123'127email:128type: string129example: '[email protected]'130required: true131responses:132'200':133description: Sucessfully created user134content:135application/json:136schema:137type: object138properties:139message:140type: string141example: 'Successfully registered. Login to receive an auth token.'142status:143type: string144enum: ['success', 'fail']145example: 'success'146'400':147description: Invalid request148content: {}149/users/v1/login:150post:151tags:152- users153summary: Login to VAmPI154description: Login to VAmPI155operationId: api_views.users.login_user156requestBody:157description: Username of the user158content:159application/json:160schema:161type: object162properties:163username:164type: string165example: 'John.Doe'166password:167type: string168example: 'password123'169required: true170responses:171'200':172description: Sucessfully logged in user173content:174application/json:175schema:176type: object177properties:178auth_token:179type: string180example: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzAxNjA2MTcsImlhdCI6MTY3MDE2MDU1Nywic3ViIjoiSm9obi5Eb2UifQ.n17N4AxTbL4_z65-NR46meoytauPDjImUxrLiUMSTQw'181message:182type: string183example: 'Successfully logged in.'184status:185type: string186enum: ['success', 'fail']187example: 'success'188'400':189description: Invalid request190content:191application/json:192schema:193type: object194properties:195status:196type: string197enum: ['fail']198example: 'fail'199message:200type: string201example: 'Password is not correct for the given username.'202/users/v1/{username}:203get:204tags:205- users206summary: Retrieves user by username207description: Displays user by username208operationId: api_views.users.get_by_username209parameters:210- name: username211in: path212description: retrieve username data213required: true214schema:215type: string216example: 'John.Doe'217responses:218'200':219description: Successfully display user info220content:221application/json:222schema:223type: array224items:225type: object226properties:227username:228type: string229example: 'John.Doe'230email:231type: string232example: '[email protected]'233'404':234description: User not found235content:236application/json:237schema:238type: object239properties:240status:241type: string242enum: ['fail']243example: 'fail'244message:245type: string246example: 'User not found'247248delete:249tags:250- users251summary: Deletes user by username (Only Admins)252description: Deletes user by username (Only Admins)253operationId: api_views.users.delete_user254parameters:255- name: username256in: path257description: Delete username258required: true259schema:260type: string261example: 'name1'262responses:263'200':264description: Sucessfully deleted user265content:266application/json:267schema:268type: object269properties:270message:271type: string272example: 'User deleted.'273status:274type: string275enum: ['success', 'fail']276example: 'success'277'401':278description: User not authorized279content:280application/json:281schema:282type: object283properties:284status:285type: string286example: 'fail'287enum: ['fail']288message:289type: string290example: 'Only Admins may delete users!'291'404':292description: User not found293content:294application/json:295schema:296type: object297properties:298status:299type: string300example: 'fail'301enum: ['fail']302message:303type: string304example: 'User not found!'305/users/v1/{username}/email:306put:307tags:308- users309summary: Update users email310description: Update a single users email311operationId: api_views.users.update_email312parameters:313- name: username314in: path315description: username to update email316required: true317schema:318type: string319example: 'name1'320requestBody:321description: field to update322content:323application/json:324schema:325type: object326properties:327email:328type: string329example: '[email protected]'330required: true331responses:332'204':333description: Sucessfully updated user email334content: {}335'400':336description: Invalid request337content:338application/json:339schema:340type: object341properties:342status:343type: string344enum: ['fail']345example: 'fail'346message:347type: string348example: 'Please Provide a valid email address.'349'401':350description: User not authorized351content:352application/json:353schema:354type: object355properties:356status:357type: string358enum: ['fail']359example: 'fail'360message:361type: string362example: 'Invalid Token'363/users/v1/{username}/password:364put:365tags:366- users367summary: Update users password368description: Update users password369operationId: api_views.users.update_password370parameters:371- name: username372in: path373description: username to update password374required: true375schema:376type: string377example: 'name1'378requestBody:379description: field to update380content:381application/json:382schema:383type: object384properties:385password:386type: string387example: 'pass4'388required: true389responses:390'204':391description: Sucessfully updated users password392content: {}393'400':394description: Invalid request395content:396application/json:397schema:398type: object399properties:400status:401type: string402enum: ['fail']403example: 'fail'404message:405type: string406example: 'Malformed Data'407'401':408description: User not authorized409content:410application/json:411schema:412type: object413properties:414status:415type: string416enum: ['fail']417example: 'fail'418message:419type: string420example: 'Invalid Token'421/books/v1:422get:423tags:424- books425summary: Retrieves all books426description: Retrieves all books427operationId: api_views.books.get_all_books428responses:429'200':430description: See all books431content:432application/json:433schema:434type: object435properties:436Books:437type: array438items:439type: object440properties:441book_title:442type: string443user:444type: string445example:446Books:447- book_title: 'bookTitle77'448user: 'name1'449- book_title: 'bookTitle85'450user: 'name2'451- book_title: 'bookTitle47'452user: 'admin'453post:454tags:455- books456summary: Add new book457description: Add new book458operationId: api_views.books.add_new_book459requestBody:460description: >-461Add new book with title and secret content only available to the user462who added it.463content:464application/json:465schema:466type: object467properties:468book_title:469type: string470example: 'book99'471secret:472type: string473example: 'pass1secret'474required: true475responses:476'200':477description: Sucessfully added a book478content:479application/json:480schema:481type: object482properties:483message:484type: string485example: 'Book has been added.'486status:487type: string488enum: ['success', 'fail']489example: 'success'490'400':491description: Invalid request492content:493application/json:494schema:495type: object496properties:497status:498type: string499enum: ['fail']500example: 'fail'501message:502type: string503example: 'Book Already exists!'504'401':505description: User not authorized506content:507application/json:508schema:509type: object510properties:511status:512type: string513enum: ['fail']514example: 'fail'515message:516type: string517example: 'Invalid Token'518/books/v1/{book_title}:519get:520tags:521- books522summary: Retrieves book by title along with secret523description: >-524Retrieves book by title along with secret. Only the owner may retrieve525it526operationId: api_views.books.get_by_title527parameters:528- name: book_title529in: path530description: retrieve book data531required: true532schema:533type: string534example: 'bookTitle77'535responses:536'200':537description: Successfully retrieve book info538content:539application/json:540schema:541type: array542items:543type: object544properties:545book_title:546type: string547example: 'bookTitle77'548owner:549type: string550example: 'name1'551secret:552type: string553example: 'secret for bookTitle77'554'401':555description: User not authorized556content:557application/json:558schema:559type: object560properties:561status:562type: string563enum: ['fail']564example: 'fail'565message:566type: string567example: 'Invalid Token'568'404':569description: Book not found570content:571application/json:572schema:573type: object574properties:575status:576type: string577enum: ['fail']578example: 'fail'579message:580type: string581example: 'Book not found!'582583