{ "error": "The requested database wasn't found" }
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/branchesOutput:
{ "branches": { "main": { "commit": "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59", "commit_count": 2, "description": "Our main development branch" } }, "default_branch": "main" }
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" -F table="table1" https://api.dbhub.io/v1/columnsOutput:
[ { "column_id": 0, "name": "id", "data_type": "INTEGER", "not_null": false, "default_value": "", "primary_key": 1, "autoinc": false, "collation_seq": "" }, { "column_id": 1, "name": "Name", "data_type": "TEXT", "not_null": false, "default_value": "", "primary_key": 0, "autoinc": false, "collation_seq": "" } ]
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/commitsOutput:
{ "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59": { "author_email": "justin@postgresql.org", "author_name": "Justin Clift", "committer_email": "", "committer_name": "", "id": "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59", "message": "", "other_parents": null, "parent": "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521", "timestamp": "2020-07-30T12:22:46.714728207Z", "tree": { "id": "2a1969fe687ba6419ccea8c6ab104741fc5fa0195d32e8cf142e422dee2d41f1", "entries": [ { "entry_type": "db", "last_modified": "2020-07-30T12:09:10Z", "licence": "a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499", "name": "Join Testing.sqlite", "sha256": "0ef691111cde5923085a2385a609c858555ec7101e3cda30dac94d1cf47429dc", "size": 12288 } ] } }, "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521": { "author_email": "justin@postgresql.org", "author_name": "Justin Clift", "committer_email": "", "committer_name": "", "id": "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521", "message": "Initial database upload, using licence CC0.", "other_parents": null, "parent": "", "timestamp": "2020-04-20T12:04:37.379693233Z", "tree": { "id": "51c87fe5a7b261e8f04d319ed50810198577b44a95701bc14917560d461948e0", "entries": [ { "entry_type": "db", "last_modified": "2020-04-20T12:04:37.373275716Z", "licence": "a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499", "name": "Join Testing.sqlite", "sha256": "488f863d685125a82b1112304c936a8c8769d061a114ec466fd21bb882dc8d17", "size": 12288 } ] } } }
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/databasesOutput:
[ "Join Testing.sqlite", "Assembly Election 2017.sqlite", "DB4S daily users by country.sqlite", "Marine Litter Survey (Keep Northern Ireland Beautiful).sqlite" ]
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/deleteOutput:
{ "status": "OK" }
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner_a="justinclift" -F dbname_a="Join Testing.sqlite" -F commit_a="c82ba65add364427e9af3f540be8bf98e8cd6bdb825b07c334858e816c983db0" \ -F commit_b="7beb90a62a842dcb095592a5083f22533552da17eb72891d26c87ae48070885d" -F merge="preserve_pk" https://api.dbhub.io/v1/diffOutput:
{ "diff": [ { "object_name": "table2", "object_type": "table", "data": [ { "action_type": "modify", "sql": "UPDATE \"table2\" SET \"value\"=5.1 WHERE \"rowid\"=1;", "pk": [ { "Name": "rowid", "Type": 4, "Value": "1" } ] } ] }, { "object_name": "joinedView", "object_type": "view", "schema": { "action_type": "add", "sql": "CREATE VIEW joinedView AS\nSELECT table1.Name, table2.value\nFROM table1 JOIN table2\nUSING (id)\nORDER BY table1.id;" } } ] }
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/download
UPDATE table1 SET Name = 'Testing 1' WHERE id = 1Using curl, it would be:
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" \ -F sql="VVBEQVRFIHRhYmxlMSBTRVQgTmFtZSA9ICdUZXN0aW5nIDEnIFdIRVJFIGlkID0gMQ==" \ https://api.dbhub.io/v1/executeOutput:
{ "rows_changed": 1, "status": "OK" }Note - This is a newly added EXPERIMENTAL function, that only works with LIVE databases. To try it out Upload a new "LIVE" database using this API, or use the Upload page on the main DBHub.io website and select the LIVE option under "Advanced".
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/indexesOutput:
[ { "name": "indexId", "table": "table1", "columns": [ { "id": 0, "name": "id" } ] }, { "name": "indexName", "table": "table1", "columns": [ { "id": 1, "name": "Name" } ] } ]
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/metadataOutput:
{ "branches": { "main": { "commit": "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59", "commit_count": 2, "description": "" } }, "commits": { "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59": { "author_email": "justin@postgresql.org", "author_name": "Justin Clift", "committer_email": "", "committer_name": "", "id": "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59", "message": "", "other_parents": null, "parent": "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521", "timestamp": "2020-07-30T12:22:46.714728207Z", "tree": { "id": "2a1969fe687ba6419ccea8c6ab104741fc5fa0195d32e8cf142e422dee2d41f1", "entries": [ { "entry_type": "db", "last_modified": "2020-07-30T12:09:10Z", "licence": "a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499", "name": "Join Testing.sqlite", "sha256": "0ef691111cde5923085a2385a609c858555ec7101e3cda30dac94d1cf47429dc", "size": 12288 } ] } }, "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521": { "author_email": "justin@postgresql.org", "author_name": "Justin Clift", "committer_email": "", "committer_name": "", "id": "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521", "message": "Initial database upload, using licence CC0.", "other_parents": null, "parent": "", "timestamp": "2020-04-20T12:04:37.379693233Z", "tree": { "id": "51c87fe5a7b261e8f04d319ed50810198577b44a95701bc14917560d461948e0", "entries": [ { "entry_type": "db", "last_modified": "2020-04-20T12:04:37.373275716Z", "licence": "a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499", "name": "Join Testing.sqlite", "sha256": "488f863d685125a82b1112304c936a8c8769d061a114ec466fd21bb882dc8d17", "size": 12288 } ] } } }, "default_branch": "main", "releases": { "v0.0.1": { "commit": "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521", "date": "2020-08-05T21:24:03.661192606+10:00", "description": "Initial release! :)", "email": "justin@postgresql.org", "name": "Justin Clift", "size": 12288 }, "v0.0.2": { "commit": "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59", "date": "2020-08-05T21:25:14.160011088+10:00", "description": "Another release", "email": "justin@postgresql.org", "name": "Justin Clift", "size": 12288 } }, "tags": { "first": { "commit": "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521", "date": "2020-08-05T21:27:36.493329953+10:00", "description": "First tag", "email": "justin@postgresql.org", "name": "Justin Clift" }, "second": { "commit": "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59", "date": "2020-08-05T21:27:50.253727352+10:00", "description": "Second tag", "email": "justin@postgresql.org", "name": "Justin Clift" } }, "web_page": "https://dbhub.io/justinclift/Join Testing.sqlite" }
SELECT table1.Name, table2.value FROM table1 JOIN table2 USING (id) ORDER BY table1.id;Using curl, it would be:
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" \ -F sql="U0VMRUNUIHRhYmxlMS5OYW1lLCB0YWJsZTIudmFsdWUKRlJPTSB0YWJsZTEgSk9JTiB0YWJsZTIKVVNJTkcgKGlkKQpPUkRFUiBCWSB0YWJsZTEuaWQ7" \ https://api.dbhub.io/v1/queryOutput:
[[{"Name":"Name","Type":3,"Value":"Foo"} ... (shortened for clarity)Note - If you'd like the data to be returned in a different format, please let us know. It's easy for us to add new output formats, and helps make a better API. :)
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/releasesOutput:
{ "v0.0.1": { "commit": "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521", "date": "2020-08-05T21:24:03.661192606+10:00", "description": "Initial release! :)", "email": "justin@postgresql.org", "name": "Justin Clift", "size": 12288 }, "v0.0.2": { "commit": "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59", "date": "2020-08-05T21:25:14.160011088+10:00", "description": "Another release", "email": "justin@postgresql.org", "name": "Justin Clift", "size": 12288 } }
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/tablesOutput:
[ "table1", "table2", "table3" ]
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/tagsOutput:
{ "first": { "commit": "ee752d746655cf141971a5db011aec2f395213cf76d8aa9c613a6c16902df521", "date": "2020-08-05T21:27:36.493329953+10:00", "description": "First tag", "email": "justin@postgresql.org", "name": "Justin Clift" }, "second": { "commit": "cb70855613d30019055a4d907b832c10014b0393556fc282e6b7d2803e2e9d59", "date": "2020-08-05T21:27:50.253727352+10:00", "description": "Second tag", "email": "justin@postgresql.org", "name": "Justin Clift" } }
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbname="Join Testing.sqlite" \ -F file=@someupload.sqlite -F "branch=main" -F "commitmsg=stuff" -F "sourceurl=https://example.org" \ -F "lastmodified=2017-01-02T03:04:05Z" -F "licence=CC0" -F "public=true" https://api.dbhub.io/v1/uploadOutput:
{ "commit": "e6ab7a2afbb5537d9e57d54c0a2a5d9e4033e1aa6db810cb9a63642a04e3813d", "url": "https://dbhub.io/justinclift/Join Testing.sqlite?branch=main\u0026commit=e6ab7a2afbb5537d9e57d54c0a2a5d9e4033e1aa6db810cb9a63642a04e3813d" }
$ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/viewsOutput:
[ "joinedView", "view1", "view2" ]
$ $ curl -F apikey="YOUR_API_KEY_HERE" -F dbowner="justinclift" -F dbname="Join Testing.sqlite" https://api.dbhub.io/v1/webpageOutput:
{ "web_page": "https://dbhub.io/justinclift/Join Testing.sqlite" }