You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/utils-helper.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,24 @@ This returns a [Document](objects-document.md) object which provided all content
21
21
>
22
22
> See more about Exceptions in the [Exception section](exception-introduction.md).
23
23
24
+
### Parse a JSON API request body
25
+
26
+
Assuming you have get a request for creating a new resource. In this case the `id` in the resource item can be missed and you have to tell the Manager about this case. Use `parseRequestBody()` to work with the data.
This returns a [Document](objects-document.md) object which provided all contents.
37
+
38
+
> **Note:** If `$jsonapi_string` contains not valid JSON or JSON API a [Exception\ValidationException](exception-introduction.md#exceptionvalidationexception) will be thrown.
39
+
>
40
+
> See more about Exceptions in the [Exception section](exception-introduction.md).
Copy file name to clipboardExpand all lines: docs/utils-manager.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,27 @@ This returns a [Document](objects-document.md) object which provided all content
21
21
22
22
> **Note:** If `$jsonapi_string` contains not valid JSON or JSON API a [Exception\ValidationException](exception-introduction.md#exceptionvalidationexception) will be thrown.
23
23
24
+
### Parse a JSON API string for creating a new resource
25
+
26
+
Assuming you have get a request for creating a new resource. In this case the `id` in the resource item can be missed and you have to tell the Manager about this case.
$manager = new \Art4\JsonApiClient\Utils\Manager();
34
+
35
+
// Set this to `true`
36
+
$manager->setConfig('optional_item_id', true);
37
+
38
+
$document = $manager->parse($jsonapi_string);
39
+
```
40
+
41
+
This returns a [Document](objects-document.md) object which provided all contents.
42
+
43
+
> **Note:** If `$jsonapi_string` contains not valid JSON or JSON API a [Exception\ValidationException](exception-introduction.md#exceptionvalidationexception) will be thrown.
44
+
24
45
### Working with a factory
25
46
26
47
You can set a custom [Factory](utils->factory.md) to the manager through `setFactory()` or the constructor.
0 commit comments