Input Abstraction

For many operations, an ID is needed. These IDs usually are numbers, and thus hard to remember for humans. Therefore, whenever a data record has a unique alias (like user_id - user_name), the alias can be used instead of the numeric ID.

The table below shows some use cases over different channels. The Web column shows the requests from current Joomla 3.4.1

CLI REST Web

Get a list of users

$ joomla users show
        
GET /users HTTP/1.1
Host: example.com
Accept: application/xml

        
GET index.php?option=com_users&view=users HTTP/1.1
Host: example.com
Accept: text/html
        

Get details of a user

$ joomla users show --id=1234
        
GET /users/1234 HTTP/1.1
Host: example.com
Accept: application/xml

        
GET index.php?option=com_users&view=user&id=1234 HTTP/1.1
Host: example.com
Accept: text/html
        
(in theory - there is no detail view for users in 3.4)

Add a user note

$ joomla user-notes add --user-id=1234 \
    --subject="..." \
    --body="..." \
    --catid=7 \
    --review-time="..." \
    --version-note="..."
        
POST /users/1234/notes HTTP/1.1
Host: example.com
Accept: application/xml
Content-Type: application/xml
Content-Length: ...

<user-note>
    <subject><![CDATA[...]]></subject>
    <catid>7</catid>
    <review_time>...</review_time>
    <version_note>...</version_note>
    <body><![CDATA[...]]></body>
</user-note>
        
POST /index.php?option=com_users&view=note&id=0 HTTP/1.1
Host: example.com
Accept: text/html
Content-Type: application/x-www-form-urlencoded
Content-Length: ...

jform%5Bsubject%5D=...&jform%5Buser_id%5D=1234&jf
orm%5Bcatid%5D=7&jform%5Bstate%5D=1&jform%5Brevie
w_time%5D=&jform%5Bversion_note%5D=&jform%5Bbody%
5D=...&task=note.save&789ab4e5a25391f60c435dcced5
40c1c=1
        

Delete a user note

$ joomla user-notes delete --id=567
        
DELETE /users/1234/notes/567 HTTP/1.1
Host: example.com
Accept: application/xml

        
POST /administrator/index.php?option=com_users&view=notes HTTP/1.1
Host: example.com
Accept: text/html
Content-Type: application/x-www-form-urlencoded
Content-Length: ...

filter_published=&filter_category_id=&filter_sear
ch=&limit=20&directionTable=&sortTable=a.review_t
ime&checkall-toggle=&limitstart=0&cid=&task=notes
.trash&boxchecked=1&filter_order=a.review_time&fi
lter_order_Dir=DESC&789ab4e5a25391f60c435dcced540
c1c=1
        

Routing

For most of the requests, the REST and Web requests should only differ in the Accept header field (and the Content-Type) to make routing much more handy. For search engine optimizations (SEO), articles can contain their own routing information in the alias field. If an alias starts with a slash, it is used un-prefixed. Otherwise, the category alias is set in front of it recursively, until a category has a leading slash or is a root category. The site owner is responsible for avoiding conflicts.

Redirection

Any redirection, which currently is initiated by the server, should be handled on the client’s side. Since the response contains all relevant links, it should be easy for the client to redirect itself to the right page.

Input Definitions

In all cases, the input definition comes from the model’s form description, so it should be possible to generate them automatically.