api de gestion de ticket, basé sur php-crud-api. Le but est de décorrélé les outils de gestion des données, afin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

raml.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. require "Inflector.php";
  3. $url = "http://localhost/api.php";
  4. $hostname = "localhost";
  5. $username = "root";
  6. $password = "root";
  7. $database = "mysql_crud_api";
  8. $mysqli = new mysqli($hostname,$username,$password,$database);
  9. if ($mysqli->connect_errno) {
  10. throw new \Exception('Connect failed: '.$mysqli->connect_error);
  11. }
  12. $tables = array();
  13. if ($result = $mysqli->query("SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA` = '$database'")) {
  14. while ($row = $result->fetch_row()) $tables[] = $row[0];
  15. }
  16. $result->close();
  17. echo "#%RAML 0.8\n";
  18. echo "title: $database\n";
  19. echo "version: 1\n";
  20. echo "baseUri: $url\n";
  21. foreach ($tables as $object_table) {
  22. $objects = Inflector::humanize($object_table);
  23. $object = Inflector::humanize(Inflector::singularize($object_table));
  24. echo "/$object_table:\n";
  25. echo " displayName: $objects\n";
  26. echo " description: A collection of $objects\n";
  27. echo " get:\n";
  28. echo " description: Get a list of $objects\n";
  29. echo " queryParameters:\n";
  30. echo " page:\n";
  31. echo " description: Specify the page that you want to retrieve\n";
  32. echo " required: false\n";
  33. echo " filter:\n";
  34. echo " description: Set to filter the list on a specific field\n";
  35. echo " required: false\n";
  36. echo " match:\n";
  37. echo " description: Adjust the way the filter matches the value to the field\n";
  38. echo " required: false\n";
  39. echo " order:\n";
  40. echo " description: Specify to change the sorting of the list\n";
  41. echo " required: false\n";
  42. echo " post:\n";
  43. echo " description: Create a $object\n";
  44. echo " /{id}:\n";
  45. echo " description: A specific $object, a member of the $objects collection\n";
  46. echo " get:\n";
  47. echo " description: Get a specific $object\n";
  48. echo " put:\n";
  49. echo " description: Update a $object\n";
  50. echo " delete:\n";
  51. echo " description: Delete a $object\n";
  52. }