Using Swagger-php/ui as an API test

Source: Internet
Author: User
Do API testing with Swagger-php/ui
Function:
1 swagger-php generate the API request rules according to custom rules, generate JSON files through Phar
2 Open swagger-ui/dist/index.html. Enter the JSON folder directory address (requires the same origin), Swagger-ui will generate the API according to the requested JSON, the page is very beautiful. Execution gets the return value when the request parameter is entered.
Disadvantage: The returned data cannot be validated. Features like Chrome's plugin postman.
API Action Test Reference code:
resource/postaction.php
 
Project description Information
info/api.php
 
   
Readme
# Usage of API docs### Raw Spec structure* info-general info.* model-entity class* resource-api endpoint### Compile API info.* After modify the spec, run shell script, as follows. ' CD Api-docs './gendocumentation.sh ' * The compiled content (. json) is stored in documentation/output/### View API docs* visit http://{domain}/documenation/


SH Execution file
#!/bin/sh. /swagger-php/swagger.phar. /output-docs-o. /documentation/output/

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.