From: Banana Date: Wed, 30 Dec 2020 11:59:20 +0000 (+0100) Subject: api documentation X-Git-Tag: 1.0~47 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=3107aea84b882547fa416ac560d61b1e7a979b38;p=bibliotheca-php.git api documentation --- diff --git a/README b/README index c1b0b25..366a65d 100644 --- a/README +++ b/README @@ -13,32 +13,5 @@ https://www.bananas-playground.net/projekt/bibliotheca/ ## Technical information This is build and tested on a linux based OS. Windows support not yet. -### API -api.php?QUERY_PARAMETERS - -collection=NUMBER - ID of a collection - -p=list - Get the latest 10 for given collection - -p=add&collection=NUMBER&authKey=API_AUTH_TOKEN - POST call to add a new entry to given collection. - See p=addInfo for the details which info is needed in the add call - -p=addInfo&collection=NUMBER - Describes how the data in the POST add call should be formated. - The JSON info in the data field, tells which fields are available and in which format the value - is accepted. - Expected is a curl call with an array as payload - - -The result is json -{ - "message": "Message as string", - "status": INTEGER based on HTTP_STATUS CODE - "data": {} -} - ## third party https://github.com/FabianBeiner/PHP-IMDB-Grabber with some modifications diff --git a/TODO b/TODO index f9b3001..030e3ad 100644 --- a/TODO +++ b/TODO @@ -1,15 +1,14 @@ -User management: Adding secondary groups -User management: Rights for a user and group. Used in user and group selections. -Field management: Web interface -Collection fields: final remove from entry table -Management which fields should be displayed in dashboard -Use try/catch for mysql stuff -Better error handling and display while adding / update and delete -better debug. When debug true, write into log file. -> see if(DEBUG) -Mass edit of entries -delete of a collection -jdoc formatierung -sort by filter for collection display -UI -- responsive and breakpoints -Advanced search. More options and searchable fields +* User management: Adding secondary groups +* User management: Rights for a user and group. Used in user and group selections. +* Field management: Web interface +* Collection fields: final remove from entry table +* Management which fields should be displayed in dashboard +* Use try/catch for mysql stuff +* Better error handling and display while adding / update and delete +* better debug. When debug true, write into log file. -> see if(DEBUG) +* Mass edit of entries +* delete of a collection +* jdoc formatierung +* sort by filter for collection display +* responsive and breakpoints +* Advanced search. More options and searchable fields diff --git a/documentation/api.txt b/documentation/api.txt new file mode 100644 index 0000000..f968463 --- /dev/null +++ b/documentation/api.txt @@ -0,0 +1,30 @@ +Small API to get information and add entries. + +# Access +api.php?QUERY_PARAMETERS + +# Parameters +collection=NUMBER + ID of a collection + +p=list + Get the latest 10 for given collection + +p=add&collection=NUMBER&authKey=API_AUTH_TOKEN + POST call to add a new entry to given collection. + See p=addInfo for the details which info is needed in the add call + More information can be found in import.txt + +p=addInfo&collection=NUMBER + Describes how the data in the POST add call should be formatted. + The JSON info in the data field, tells which fields are available and in which format the value + is accepted. + Expected is a curl call with an array as payload + +# Response +The result is json +{ + "message": "Message as string", + "status": INTEGER based on HTTP_STATUS CODE + "data": {} +} diff --git a/documentation/import.txt b/documentation/import.txt new file mode 100644 index 0000000..41fdf88 --- /dev/null +++ b/documentation/import.txt @@ -0,0 +1,91 @@ +The API provides an import method. + +You need the URL to your installation and api file. +You need the token. Can be created in user management and has a lifespan. +You need the information which collection to import to and what data can be imported. + +A working php example with example data-crow data can be found here: +http://91.132.146.200:3000/Banana/bibliotheca-tools/src/master/data-crow/run-import-to-bibliotheca.php +http://91.132.146.200:3000/Banana/bibliotheca-tools/src/master/data-crow/README + +Info which data can be imported in example collation #1 + +{ + "message": "API POST and FILES data information for collection: Movies", + "status": 200, + "data": { + "title": { + "input": "string 128" + }, + "description": { + "input": "string 64" + }, + "content": { + "input": "mysql text" + }, + "rating": { + "input": "One of 0/10,2/10,3/10,4/10,5/10,6/10,7/10,8/10,9/10,10/10" + }, + "actors": { + "input": "string 64" + }, + "directors": { + "input": "string 64" + }, + "genres": { + "input": "string 64" + }, + "runtime": { + "input": "string 128" + }, + "countries": { + "input": "string 64" + }, + "languages": { + "input": "string 64" + }, + "year": { + "input": "mysql year" + }, + "imdbrating": { + "input": "string 128" + }, + "viewcount": { + "input": "string 128" + }, + "storage": { + "input": "string 64" + }, + "tag": { + "input": "string 64" + }, + "category": { + "input": "string 64" + }, + "coverimage": { + "input": "One file in $_FILES[uploads] of post" + }, + "attachment": { + "input": "Multiple in $_FILES[uploads] of post" + } + } +} + +Array structure to be send as POST with curl to: api.php?&authKey=API_TOKEN&collection=COLLECTION_ID + +array(15) { + ["actors"]=> string(52) "Amber Heard,Gary Oldman,Harrison Ford,Liam Hemsworth" + ["countries"]=> string(20) "France,United States" + ["content"]=> string(628) "The high stakes thriller Paranoia takes us deep behind the scenes of global success to a deadly world of greed and deception. The two most powerful tech billionaires in the world (Harrison Ford and Gary Oldman) are bitter rivals with a complicated past who will stop at nothing to destroy each other. A young superstar (Liam Hemsworth), seduced by unlimited wealth and power falls between them, and becomes trapped in the middle of the twists and turns of their life-and-death game of corporate espionage. By the time he realizes his life is in danger, he is in far too deep and knows far too much for them to let him walk away." ["description"]=> string(125) "The high stakes thriller Paranoia takes us deep behind the scenes of global success to a deadly world of greed and deception." + ["directors"]=> string(14) "Robert Luketic" + ["genres"]=> string(14) "Drama,Thriller" + ["title"]=> string(8) "Paranoia" + ["languages"]=> string(7) "English" + ["coverimage"]=> object(CURLFile)#356 (3) { ["name"]=> string(87) "import/movie/movies-export_images/00330b7f-5df8-49fa-ad79-2d1eb8ebb38c_PictureFront.jpg" ["mime"]=> string(0) "" ["postname"]=> string(0) "" } + ["rating"]=> string(4) "6/10" + ["runtime"]=> string(0) "" + ["tag"]=> string(9) "Storage B" + ["year"]=> string(4) "2013" + ["attachment[0]"]=> object(CURLFile)#343 (3) { ["name"]=> string(87) "import/movie/movies-export_images/0efb720d-d9e5-406b-aa42-e356f9c544e9_PictureFront.jpg" ["mime"]=> string(0) "" ["postname"]=> string(0) "" } + ["attachment[1]"]=> object(CURLFile)#342 (3) { ["name"]=> string(87) "import/movie/movies-export_images/3edf49eb-0270-456d-a15d-e5ddcba302ed_PictureFront.jpg" ["mime"]=> string(0) "" ["postname"]=> string(0) "" } +} diff --git a/documentation/usermanagement.txt b/documentation/usermanagement.txt index 4ef2c89..9780596 100644 --- a/documentation/usermanagement.txt +++ b/documentation/usermanagement.txt @@ -1,4 +1,4 @@ -Curently there is only a user management. Groups or default users can not be changed. +Currently there is only a user management. Groups or default users can not be changed. Default users are: