| 20 | | * without method: |
| 21 | | - if no record ID/UID in the URL: '''list''' view of the resource |
| 22 | | - with a record ID/UID in the URL: '''read''' view of the specified record (if the user is permitted to update the record, an '''update''' form returned instead) |
| | 18 | ||='''Method'''=||='''GET'''=||='''POST'''=||='''PUT'''=||='''DELETE'''=|| |
| | 19 | ||'''resource'''||return a view of all available records in the resource (Standard: data table)||submission of a form to create a new record||see POST||-|| |
| | 20 | ||'''resource/<ID>'''||return a view of a single record (update form if permitted, otherwise read-only)||submission of a form to update a record||see POST||delete the specified record|| |
| | 21 | ||'''resource/create'''||return a form to create a new record||submission of a form to create a new record||see POST||-|| |
| | 22 | ||'''resource/<ID>/read'''||return a view of a single record (read-only)||-||-||-|| |
| | 23 | ||'''resource/<ID>/update'''||return a form to update the specified record||submission of a form to update a record||see POST||-|| |
| | 24 | ||'''resource/delete'''||get a form to confirm the deletion of records||delete all records||-||see POST|| |
| | 25 | ||'''resource/<ID>/delete'''||delete the specified record||see GET||-||see GET|| |
| 29 | | * with '''method''' in the URL: |
| 30 | | - method '''create''' returns a create-form |
| 31 | | - method '''read''' returns a view of the specified record (other than with blank method, no update form is returned in this case) |
| 32 | | - method '''update''' returns an update form for the specified record |
| 33 | | - method '''delete''' returns a delete confirmation form together with a list of the specified records (if there is exactly one record identified by its ID or UID, then the record will be deleted instead of a form being returned, see POST) |
| | 29 | Transformable formats include: xml, json, s3csv |
| 35 | | ''Example:'' '''create''' form for the pr_person table: |
| 36 | | {{{ |
| 37 | | http://localhost:8000/eden/pr/person/create |
| 38 | | }}} |
| | 31 | ||='''Method'''=||='''GET'''=||='''POST'''=||='''PUT'''=||='''DELETE'''=|| |
| | 32 | ||'''resource'''||export all (accessible) records in the specified resource||see PUT||import records from the request body||-|| |
| | 33 | ||'''resource/<ID>'''||export the specified record||see PUT||import (update) the specified record from the request body||-|| |
| | 34 | ||'''resource/create'''||return a resource structure description of the specified resource||see PUT||import records from the request body||-|| |
| | 35 | ||'''resource/create?filename=xyz.xml'''||import new records from the specified file||see PUT||import records from the request body||-|| |
| | 36 | ||'''resource/create?fetchurl=!http://site/xyz.xml'''||import new records from the specified URL||see PUT||import records from the request body||-|| |
| | 37 | ||'''resource/update'''||return a resource structure description of the specified resource||see PUT||import records from the request body||-|| |
| | 38 | ||'''resource/update?filename=xyz.xml'''||import new records from the specified file||see PUT||import records from the request body||-|| |
| | 39 | ||'''resource/update?fetchurl=!http://site/xyz.xml'''||import new records from the specified URL||see PUT||import records from the request body||-|| |
| | 40 | ||'''resource/<ID>/update?filename=xyz.xml'''||import a record update from the specified file||see PUT||import a record update from the request body||-|| |
| | 41 | ||'''resource/<ID>/update?fetchurl=!http://site/xyz.xml'''||import a record update from the specified URL||see PUT||import a record update from the request body||-|| |
| | 42 | ||'''resource/read'''||export all (accessible) records in the specified resource||see PUT||import records from the request body||-|| |
| | 43 | ||'''resource/<ID>/read'''||export the specified record||see PUT||import a record update from the request body||-|| |
| | 44 | ||'''resource/delete'''||-||-||-||Delete all accessible records in the resource|| |
| | 45 | ||'''resource/<ID>/delete'''||-||-||-||Delete the specified record|| |
| 40 | | * some resources support other (custom) methods, e.g. |
| 41 | | - '''search_simple''' returns a form for simple string search in the resource |
| 42 | | |
| 43 | | ''Example:'' simple '''search''' for a person by name or ID: |
| 44 | | {{{ |
| 45 | | http://localhost:8000/eden/pr/person/search_simple |
| 46 | | }}} |
| 47 | | ==== Non-interactive formats ==== |
| 48 | | |
| 49 | | * without '''method''': |
| 50 | | - returns all matching records in the specified format |
| 51 | | |
| 52 | | ''Example:'' all {{{person}}} records the user is allowed to read, in PFIF format: |
| 53 | | {{{ |
| 54 | | http://localhost:8000/eden/pr/person.pfif |
| 55 | | }}} |
| 56 | | |
| 57 | | |
| 58 | | * with '''method''' in the URL: |
| 59 | | - method '''create''' or '''update''' imports data into the resource from the specified data source: |
| 60 | | * ''?filename='' variable to specify a local file (on the server) |
| 61 | | * ''?fetchurl='' variable to specify a source URL |
| 62 | | * with format extension ''.url'' data are imported directly from the URL |
| 63 | | * if none of the above is specified, data are imported from the request body |
| 64 | | - method '''read''' returns a the specified records in the requested format |
| 65 | | - method '''delete''' deletes the specified records |
| 66 | | |
| 67 | | ''Example:'' import data from that URL into the {{{person}}} resource: |
| 68 | | {{{ |
| 69 | | http://localhost:8000/eden/pr/person.xml/create?fetchurl=http://vita.sahanafoundation.org/eden/pr/person.xml |
| 70 | | }}} |
| 71 | | |
| 72 | | * XLS and PDF format work read-only (create/update/delete being ignored) |
| 73 | | |
| 74 | | === POST === |
| 75 | | |
| 76 | | ==== Interactive Formats ==== |
| 77 | | |
| 78 | | * performs the respective '''method''' (if specified in the request) |
| 79 | | - method '''create''' creates a new record |
| 80 | | - method '''update''' updates the specified record |
| 81 | | - method '''delete''' deletes the specified record |
| 82 | | * expects the form data as multi-part request body |
| 83 | | |
| 84 | | ==== Non-interactive Formats ==== |
| 85 | | |
| 86 | | * see PUT |
| 87 | | |
| 88 | | === PUT === |
| 89 | | |
| 90 | | ==== Interactive formats ==== |
| 91 | | |
| 92 | | * see POST |
| 93 | | |
| 94 | | ==== Non-interactive formats ==== |
| 95 | | |
| 96 | | * import data from the request body (which must be in the specified format) into the resource |
| 97 | | * records being matched by the UIDs specified in the data, while any record IDs in the URL restrict the selection |
| 98 | | |
| 99 | | === DELETE === |
| 100 | | |
| 101 | | * deletes those of the addressed records which are deletable by the current user |
| | 47 | '''Note:''' in XML and JSON, data resources are always exported/imported in compound with all their subresources and referenced resources. |