Hello BaseX team,
I'm building a C# application, I'm using Rest APIs, how can I test if a database exists or not when I launch my application, and create necessary db/files when they are missing ?
Thanks, Ramzi
P Respectons ensemble l'environnement. N'imprimez ce message que si n?cessaire. Let's respect the environment together. Only print this message if necessary.
I don't know if this is the best way. To test if a database exists, I simply send a GET request to https://<host>:<port>/<context>/rest/<database> and check the response status code. A 200 OK response indicates that the database exists and a 404 Not Found response means that the database doesn't exists. Similarly, I send a GET request to https://<host>:<port>/<context>/rest/<database>/<file> and test the response status to test if a file exists.
Geoff Alexander, Ph.D. Software Engineer, Corporate Tools Development IBM Corporation Charlotte, NC
basex-talk@mailman.uni-konstanz.de