User tests: Successful: Unsuccessful:
This PR adds the possibility to define the location of the category while saving it through the API. A location can be one of the following values:
If before
or after
is used it is advisable to also set the location_reference parameter which defines the sibling the category should be located.
Run the following curl command:
curl --location --request POST 'https://[your J4 website]/api/index.php/v1/content/categories' \
--header 'Content-Type: application/json' \
--header 'X-Joomla-Token: [your user token]' \
--data-raw '{
"title": "test",
"location": "first-child",
"published": "1",
"language": "*"
}'
The new category appears as last item in the list in the back end UI.
The new category appears as first item in the list in the back end UI.
The new location
and location_reference
arguments need to be documented.
Status | New | ⇒ | Pending |
i guess we should do the same for endpoint POST {{base_path}}/api/index.php/v1/menus/{app}
I have tested this item
CS issue apart
While testing this it seems that api can by-pass the alias naming restrictions is this intended?
curl --location --request POST 'https://[domain]/api/index.php/v1/content/categories' \
--header 'Content-Type: application/json' \
--header 'X-Joomla-Token: [key]' \
--data-raw '{"location_reference":2,
"title": "test before Uncategorised",
"location": "before",
"published": "1",
"language": "*"
}
executing this command 2 times ends, in one item before and one (the second call) as last item... I know unrelated to this PR...
What the rest is working find but could we get some variable validation in this function because passing location and location_reference without input validation is wrong.
Labels |
Added:
?
?
|
Validation is done on the model level, so there is no reason to do it on the controller level as well. So if there is something missing on the validation side, it must be fixed in the model. But I casted to int in the controller to be double save.
@HLeithner can you mark your test as successful please.
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-12-30 21:13:27 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
Thanks!
@alikon , @khu5h1 can you guys give this one here a test too? Similar procedure as the other ones. Thanks!!