2
0

readme.txt 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. Intro
  2. -----
  3. This example demonstrates how to simply set up a database for export in a
  4. read-only manner.
  5. Execute with -h or --help to see the available command-line options.
  6. Setup
  7. -----
  8. The country table (country.sql) can be used for sample data in the database
  9. of your choice.
  10. Set up the connection in code (method SetUpConnection),
  11. or in a connection.ini file with the following format:
  12. [database]
  13. Type=postgresql
  14. DatabaseName=YourDatabase
  15. Host=localhost
  16. username=me
  17. password=secret
  18. port=nnnn
  19. You can use another name as connection.ini, but then you must specify the
  20. name with the -c or --config option.
  21. Once started, the server will display connection info and available resources.
  22. Things to try
  23. -------------
  24. The following list possible queries, using either wget or curl:
  25. (obviously, you can do the same in a browser)
  26. Get a list of available resources:
  27. wget -q -O - "http://localhost:3000/metadata/"
  28. curl -o - "http://localhost:3000/metadata/"
  29. Same, but only the names, in compact format:
  30. wget -q -O - "http://localhost:3000/metadata/?fl=name&fmt=csv&metadata=0"
  31. curl -o - "http://localhost:3000/metadata/?fl=name&fmt=csv&metadata=0"
  32. Get metadata for country table:
  33. wget -q -O - "http://localhost:3000/metadata/country"
  34. curl -o - "http://localhost:3000/metadata/country"
  35. Only get fieldnames:
  36. wget -q -O - "http://localhost:3000/metadata/country?fl=name&fmt=csv"
  37. curl -o - "http://localhost:3000/metadata/country?fl=name&fmt=csv"
  38. Get a list of all countries:
  39. wget -q -O - http://localhost:3000/country
  40. curl -o - http://localhost:3000/country
  41. Get a list of all countries in compact format:
  42. wget -q -O - "http://localhost:3000/country?humanreadable=0"
  43. curl -o - "http://localhost:3000/country?humanreadable=0"
  44. Same as previous, and skip metadata as well:
  45. wget -O - "http://localhost:3000/country?humanreadable=0&metadata=0"
  46. curl -o - "http://localhost:3000/country?humanreadable=0&metadata=0"
  47. Get a list of countries in XML format:
  48. wget -q -O - "http://localhost:3000/country?fmt=xml"
  49. curl -o - "http://localhost:3000/country?fmt=xml"
  50. Limit returned fields. Get a list of all ISO country codes:
  51. wget -q -O - "http://localhost:3000/country?fl=iso"
  52. curl -o - "http://localhost:3000/country?fl=iso";
  53. Same, but in CSV format:
  54. wget -q -O - "http://localhost:3000/country?fl=iso&fmt=csv"
  55. curl -o - "http://localhost:3000/country?fl=iso&fmt=csv"
  56. Filtering: only ISO3 codes that start with M:
  57. wget -q -O - "http://localhost:3000/country?iso3_gte=M&iso3_lt=N"
  58. curl -o - "http://localhost:3000/country?iso3_gte=M&iso3_lt=N"
  59. Paging: First page, 10 records:
  60. wget -q -O - "http://localhost:3000/country?limit=10"
  61. curl -o - "http://localhost:3000/country?limit=10"
  62. Paging: Second page, 10 records:
  63. wget -q -O - "http://localhost:3000/country?limit=10&offset=10"
  64. curl -o - "http://localhost:3000/country?limit=10offset=10"
  65. A full list of possibilities is available on:
  66. https://wiki.freepascal.org/SQLDBRestBridge#Features