Skip to content

Commit 1841490

Browse files
authored
Documentation v4 📝 - github.io page (#4156)
* Rector: CQ - UnusedForeachValueToArrayKeysRector (#1) * Rector: CQ - UnusedForeachValueToArrayKeysRector See Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector * fixes + phpstan See fix at rector: rectorphp/rector-src#6164 * Updated documentation * Updated documentation * Updated documentation * Updated documentation * Revert "Rector: CQ - UnusedForeachValueToArrayKeysRector (#1)" This reverts commit 3d7eaf6. * WIP - Updated documentation * Added #4208 * Added #3150 (reply in thread) * little update - modules - new config/events _ ... * Updated modules * typo * typo * added .htaccess
1 parent 44fb962 commit 1841490

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2322
-410
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/.github export-ignore
44
/dev export-ignore
55
/docs export-ignore
6+
/docs_includes export-ignore
67
/tests export-ignore
78

89
/.all-contributorsrc export-ignore

.github/workflows/docs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: MkDocs
2+
3+
on:
4+
workflow_call:
5+
# Allow manually triggering the workflow.
6+
workflow_dispatch:
7+
8+
push:
9+
branches:
10+
- main
11+
- documentation
12+
paths:
13+
- 'docs/**.md'
14+
- 'docs/**.html'
15+
- 'docs/**.yml'
16+
- 'docs_includes/**.md'
17+
- 'mkdocs.yml'
18+
permissions:
19+
contents: write
20+
jobs:
21+
deploy:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-python@v4
26+
with:
27+
python-version: 3.x
28+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
29+
30+
- uses: actions/cache@v3
31+
with:
32+
key: mkdocs-material-${{ env.cache_id }}
33+
path: .cache
34+
restore-keys: |
35+
mkdocs-material-
36+
- run: pip3 install mkdocs mkdocs-material mkdocs-minify-plugin mkdocs-redirects
37+
38+
- name: Publish docs
39+
run: mkdocs gh-deploy --force

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ phpunit.xml
9191
/shell/update-copyright.php
9292
/shell/translations.php
9393

94+
# generated by mkdocs serve
95+
/site
96+
9497
# DDEV
9598
.ddev/config.yaml
9699
.ddev/.sampleData

docs/.htaccess

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Order deny,allow
2+
Deny from all

docs/EVENTS.md

Lines changed: 0 additions & 378 deletions
This file was deleted.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Common HTTP status codes
2+
3+
HTTP status codes are an essential part of the REST concept. You can get familiar with all of them on [Wikipedia](http://en.wikipedia.org/wiki/List_of_http_status_codes).
4+
5+
The Magento API attempts to return appropriate HTTP status codes for all requests. Any information is returned in the form of a standard HTTP response with an HTTP status code describing the error and the body message.
6+
7+
## HTTP Status Codes
8+
9+
The following table contains possible common HTTP status codes:
10+
11+
| Status Code | Message |
12+
|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
13+
| 200 OK | - |
14+
| 201 Created | Resource was partially created |
15+
| 207 Multi-Status | - |
16+
| 400 Bad Request | Resource data pre-validation error.<br>Resource data invalid.<br>The request data is invalid.<br>Resource collection paging error.<br>The paging limit exceeds the allowed number.<br>Resource collection ordering error.<br>Resource collection filtering error.<br>Resource collection including additional attributes error. |
17+
| 403 Forbidden | Access denied. |
18+
| 404 Not Found | Resource not found. |
19+
| 405 Method Not Allowed | Resource does not support method.<br>Resource method not implemented yet. |
20+
| 500 Internal Error | Unhandled simple errors.<br>Resource internal error. |
21+
22+
## Error Messages
23+
24+
When the Magento API returns an error message, it returns it in your requested format. For example, an error in the XML format might look like the following:
25+
26+
```xml
27+
<?xml version="1.0"?>
28+
<magento_api>
29+
<messages>
30+
<error>
31+
<data_item>
32+
<code>404</code>
33+
<message>Resource not found.</message>
34+
</data_item>
35+
</error>
36+
</messages>
37+
</magento_api>
38+
```
39+
40+
An error in the JSON format might look like the following:
41+
42+
```json
43+
{"messages":{"error":[{"code":404,"message":"Resource not found."}]}}
44+
```

docs/content/api/rest/get_filters.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Use filters
2+
3+
_JSON responses on this page contributed by Tim Reynolds._
4+
5+
Some requests use GET parameters in the URL. These are as follows:
6+
7+
## filter
8+
9+
Specifies the filters for returned data.
10+
11+
## page
12+
13+
Specifies the page number which items will be returned.
14+
15+
!!! example
16+
```
17+
https://om.ddev.site/api/rest/products?page=1
18+
```
19+
## order, dir
20+
21+
Specifies the sort order of returned items and the order direction: `asc` - returns items in the ascending order; `dsc` - returns items in the descending order.
22+
23+
!!! example
24+
```
25+
https://om.ddev.site/api/rest/products?order=name&dir=dsc
26+
https://om.ddev.site/api/rest/products?order=name&dir=asc
27+
```
28+
## limit
29+
30+
Limits the number of returned items in the response. Note that by default, 10 items are returned in the response. The maximum number is 100 items.
31+
32+
!!! example
33+
```
34+
https://om.ddev.site/api/rest/products?limit=2
35+
```
36+
37+
## neq
38+
39+
"not equal to" - returns items with the specified attribute that is not equal to the defined value.
40+
41+
!!! example
42+
```
43+
https://om.ddev.site/api/rest/products?filter[1][attribute]=entity_id&filter[1][neq]=3
44+
```
45+
46+
## in
47+
48+
"equals any of" - returns items that are equal to the item(s) with the specified attribute(s).
49+
50+
!!! example
51+
```
52+
https://om.ddev.site/api/rest/products?filter[1][attribute]=entity_id&filter[1][in]=3
53+
```
54+
55+
## nin
56+
57+
"not equals any of" - returns items excluding the item with the specified attribute.
58+
59+
!!! example
60+
```
61+
https://om.ddev.site/api/rest/products?filter[1][attribute]=entity_id&filter[1][nin]=3
62+
```
63+
64+
## gt
65+
66+
"greater than" - returns items with the specified attribute that is greater than the defined value.
67+
68+
!!! example
69+
```
70+
https://om.ddev.site/api/rest/products?filter[1][attribute]=entity_id&filter[1][gt]=3
71+
https://om.ddev.site/api/rest/products?filter[1][attribute]=price&filter[1][gt]=300
72+
```
73+
74+
## lt
75+
76+
"less than" - returns items with the specified attribute that is less than the defined value.
77+
78+
!!! example
79+
```
80+
https://om.ddev.site/api/rest/products?filter[1][attribute]=entity_id&filter[1][lt]=4
81+
```
82+
83+
## from, to
84+
85+
Specifies the range of attributes according to which items will be returned.
86+
87+
!!! example
88+
```
89+
https://om.ddev.site/api/rest/products?filter[1][attribute]=entity_id&filter[1][from]=1&filter[1][to]=3
90+
https://om.ddev.site/api/rest/products?filter[1][attribute]=price&filter[1][from]=150&filter[1][to]=350
91+
```
92+
93+
## Whitespaces
94+
95+
If the attribute value consists of several words separated by a whitespace, the '%20' sign is used:
96+
97+
!!! example
98+
```
99+
https://om.ddev.site/api/rest/products?filter[1][attribute]=name&filter[1][in]=BlackBerry%208100%20Pearl
100+
```
101+
102+
## Example 1
103+
104+
For example, to filter products with the description equal to simple01:
105+
106+
!!! example
107+
```
108+
https://om.ddev.site/api/rest/products/?order=entity_id&filter[0][attribute]=description&filter[0][in][0]=simple01
109+
```
110+
111+
## Example 2
112+
113+
To filter customers by email address:
114+
115+
!!! example
116+
```
117+
https://om.ddev.site/api/rest/customers?filter[1][attribute]=email&filter[1][in][0]=ryan@test.com
118+
```

docs/content/api/rest/http_methods.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# HTTP methods
2+
3+
Accessing API is performed via HTTP. When you enter a URL into a web browser address bar, the browser performs an HTTP GET request to the URL. This usually returns a web page in the form of an HTTP response that the browser displays. But the GET method is one of several HTTP request methods. Magento REST API uses the four main HTTP methods: GET, POST, PUT, and DELETE. The most widespread methods are GET and POST. The other methods are less known but they became widely known due to the popularity of REST web services. An important concept of the REST architecture is that different HTTP request methods perform different actions when applied to the same URL.
4+
5+
For example:
6+
7+
```
8+
GET https://om.ddev.site/rest/customers/123
9+
```
10+
11+
will retrieve information about the specified customer;
12+
13+
```
14+
DELETE https://om.ddev.site/rest/customers/123
15+
```
16+
17+
will delete the specified customer.
18+
19+
## GET
20+
21+
**Retrieving Resources with the HTTP GET Method**
22+
23+
The HTTP GET method is defined in section 9.3 of the [RFC2616](http://www.ietf.org/rfc/rfc2616.txt) document:
24+
25+
> The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.
26+
27+
You can retrieve a representation of a resource by getting its URL.
28+
29+
## POST and PUT
30+
31+
**Creating or Updating Resources with the HTTP POST and PUT Methods**
32+
33+
The POST method is defined in section 9.5 of the [RFC2616](http://www.ietf.org/rfc/rfc2616.txt) document:
34+
35+
> The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:
36+
>
37+
> * Annotation of existing resources;
38+
>
39+
> * Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;
40+
>
41+
> * Providing a block of data, such as the result of submitting a form, to a data-handling process;
42+
>
43+
> * Extending a database through an append operation.
44+
45+
The PUT method is defined in section 9.6 of the [RFC2616](http://www.ietf.org/rfc/rfc2616.txt) document:
46+
47+
> The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server.
48+
49+
Creating or updating a resource involves performing an HTTP POST or HTTP PUT to a resource URL.
50+
51+
## DELETE
52+
53+
**Deleting Resources with the HTTP DELETE Method**
54+
55+
The DELETE method is defined in section 9.7 of the [RFC2616](http://www.ietf.org/rfc/rfc2616.txt) document:
56+
57+
> The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server.
58+
59+
Deleting a resource is performed by means of making an HTTP DELETE request to the resource URL.

0 commit comments

Comments
 (0)