Skip to content

Commit ebba251

Browse files
authored
Merge pull request #78 from 4d/develop
v18.0 release develop into master
2 parents 5033af4 + 00be5b7 commit ebba251

File tree

1,512 files changed

+20565
-1451
lines changed

Some content is hidden

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

1,512 files changed

+20565
-1451
lines changed

docs/REST/$asArray.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
id: asArray
3+
title: $asArray
4+
---
5+
6+
7+
Returns the result of a query in an array (i.e. a collection) instead of a JSON object.
8+
9+
10+
## Description
11+
12+
If you want to receive the response in an array, you just have to add `$asArray` to your REST request (*e.g.*, `$asArray=true`).
13+
14+
## Example
15+
Here is an example or how to receive the response in an array.
16+
17+
`GET /rest/Company/?$filter="name begin a"&$top=3&$asArray=true`
18+
19+
**Response**:
20+
21+
````
22+
[
23+
{
24+
"__KEY": 15,
25+
"__STAMP": 0,
26+
"ID": 15,
27+
"name": "Alpha North Yellow",
28+
"creationDate": "!!0000-00-00!!",
29+
"revenues": 82000000,
30+
"extra": null,
31+
"comments": "",
32+
"__GlobalStamp": 0
33+
},
34+
{
35+
"__KEY": 34,
36+
"__STAMP": 0,
37+
"ID": 34,
38+
"name": "Astral Partner November",
39+
"creationDate": "!!0000-00-00!!",
40+
"revenues": 90000000,
41+
"extra": null,
42+
"comments": "",
43+
"__GlobalStamp": 0
44+
},
45+
{
46+
"__KEY": 47,
47+
"__STAMP": 0,
48+
"ID": 47,
49+
"name": "Audio Production Uniform",
50+
"creationDate": "!!0000-00-00!!",
51+
"revenues": 28000000,
52+
"extra": null,
53+
"comments": "",
54+
"__GlobalStamp": 0
55+
}
56+
]
57+
````
58+
59+
The same data in its default JSON format:
60+
61+
````
62+
{
63+
"__entityModel": "Company",
64+
"__GlobalStamp": 50,
65+
"__COUNT": 52,
66+
"__FIRST": 0,
67+
"__ENTITIES": [
68+
{
69+
"__KEY": "15",
70+
"__TIMESTAMP": "2018-03-28T14:38:07.434Z",
71+
"__STAMP": 0,
72+
"ID": 15,
73+
"name": "Alpha North Yellow",
74+
"creationDate": "0!0!0",
75+
"revenues": 82000000,
76+
"extra": null,
77+
"comments": "",
78+
"__GlobalStamp": 0,
79+
"employees": {
80+
"__deferred": {
81+
"uri": "/rest/Company(15)/employees?$expand=employees"
82+
}
83+
}
84+
},
85+
{
86+
"__KEY": "34",
87+
"__TIMESTAMP": "2018-03-28T14:38:07.439Z",
88+
"__STAMP": 0,
89+
"ID": 34,
90+
"name": "Astral Partner November",
91+
"creationDate": "0!0!0",
92+
"revenues": 90000000,
93+
"extra": null,
94+
"comments": "",
95+
"__GlobalStamp": 0,
96+
"employees": {
97+
"__deferred": {
98+
"uri": "/rest/Company(34)/employees?$expand=employees"
99+
}
100+
}
101+
},
102+
{
103+
"__KEY": "47",
104+
"__TIMESTAMP": "2018-03-28T14:38:07.443Z",
105+
"__STAMP": 0,
106+
"ID": 47,
107+
"name": "Audio Production Uniform",
108+
"creationDate": "0!0!0",
109+
"revenues": 28000000,
110+
"extra": null,
111+
"comments": "",
112+
"__GlobalStamp": 0,
113+
"employees": {
114+
"__deferred": {
115+
"uri": "/rest/Company(47)/employees?$expand=employees"
116+
}
117+
}
118+
}
119+
],
120+
"__SENT": 3
121+
}
122+
````
123+
124+

docs/REST/$atomic_$atonce.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
id: atomic_$atonce
3+
title: $atomic/$atonce
4+
---
5+
6+
7+
Allows the actions in the REST request to be in a transaction. If there are no errors, the transaction is validated. Otherwise, the transaction is cancelled.
8+
9+
10+
## Description
11+
When you have multiple actions together, you can use `$atomic/$atonce` to make sure that none of the actions are completed if one of them fails. You can use either `$atomic` or `$atonce`.
12+
13+
14+
## Example
15+
We call the following REST request in a transaction.
16+
17+
`POST /rest/Employee?$method=update&$atomic=true`
18+
19+
**POST data**:
20+
21+
````
22+
[
23+
{
24+
"__KEY": "1",
25+
"__STAMP": 5,
26+
"salary": 45000
27+
},
28+
{
29+
"__KEY": "2",
30+
"__STAMP": 10,
31+
"salary": 99000
32+
}
33+
]
34+
````
35+
36+
We get the following error in the second entity and therefore the first entity is not saved either:
37+
38+
````
39+
{
40+
"__ENTITIES": [
41+
{
42+
"__KEY": "1",
43+
"__STAMP": 5,
44+
"uri": "http://127.0.0.1:8081/rest/Employee(1)",
45+
"ID": 1,
46+
"firstName": "John",
47+
"lastName": "Smith",
48+
"fullName": "John Smith",
49+
"gender": false,
50+
"telephone": "4085551111",
51+
"salary": 45000,
52+
"employerName": "Adobe",
53+
"employer": {
54+
"__deferred": {
55+
"uri": "http://127.0.0.1:8081/rest/Company(1)",
56+
"__KEY": "1"
57+
}
58+
}
59+
},
60+
{
61+
"__KEY": "2",
62+
"__STAMP": 2,
63+
"ID": 2,
64+
"firstName": "Paula",
65+
"lastName": "Miller",
66+
"fullName": "Paula Miller",
67+
"telephone": "4085559999",
68+
"salary": 36000,
69+
"employerName": "Adobe",
70+
"employer": {
71+
"__deferred": {
72+
"uri": "http://127.0.0.1:8081/rest/Company(1)",
73+
"__KEY": "1"
74+
}
75+
},
76+
"__ERROR": [
77+
{
78+
"message": "Value cannot be greater than 60000",
79+
"componentSignature": "dbmg",
80+
"errCode": 1569
81+
},
82+
{
83+
"message": "Entity fails validation",
84+
"componentSignature": "dbmg",
85+
"errCode": 1570
86+
},
87+
{
88+
"message": "The entity# 1 of the datastore class \"Employee\" cannot be saved",
89+
"componentSignature": "dbmg",
90+
"errCode": 1517
91+
}
92+
]
93+
}
94+
]
95+
}
96+
````
97+
98+
99+
>Even though the salary for the first entity has a value of 45000, this value was not saved to the server and the *timestamp (__STAMP)* was not modified either. If we reload the entity, we will see the previous value.

docs/REST/$attributes.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
id: attributes
3+
title: $attributes
4+
---
5+
6+
Allows selecting the related attribute(s) to get from the dataclass (*e.g.*, `Company(1)?$attributes=employees.lastname` or `Employee?$attributes=employer.name`).
7+
8+
9+
## Description
10+
11+
When you have relation attributes in a dataclass, use `$attributes` to define the path of attributes whose values you want to get for the related entity or entities.
12+
13+
You can apply `$attributes` to an entity (*e.g.*, People(1)) or an entity selection (*e.g.*, People/$entityset/0AF4679A5C394746BFEB68D2162A19FF) .
14+
15+
16+
- If `$attributes` is not specified in a query, or if the "*" value is passed, all available attributes are extracted. **Related entity** attributes are extracted with the simple form: an object with property `__KEY` (primary key). **Related entities** attributes are not extracted.
17+
18+
- If `$attributes` is specified for **related entity** attributes:
19+
- `$attributes=relatedEntity`: the related entity is returned with simple form (deferred __KEY property (primary key)).
20+
- `$attributes=relatedEntity.*`: all the attributes of the related entity are returned
21+
- `$attributes=relatedEntity.attributePath1, relatedEntity.attributePath2, ...`: only those attributes of the related entity are returned.
22+
23+
24+
- If `$attributes` is specified for **related entities** attributes:
25+
- `$attributes=relatedEntities.*`: all the properties of all the related entities are returned
26+
- `$attributes=relatedEntities.attributePath1, relatedEntities.attributePath2, ...`: only those attributes of the related entities are returned.
27+
28+
29+
30+
## Example with related entities
31+
32+
If we pass the following REST request for our Company datastore class (which has a relation attribute "employees"):
33+
34+
`GET /rest/Company(1)/?$attributes=employees.lastname`
35+
36+
**Response**:
37+
38+
```
39+
{
40+
"__entityModel": "Company",
41+
"__KEY": "1",
42+
"__TIMESTAMP": "2018-04-25T14:41:16.237Z",
43+
"__STAMP": 2,
44+
"employees": {
45+
"__ENTITYSET": "/rest/Company(1)/employees?$expand=employees",
46+
"__GlobalStamp": 50,
47+
"__COUNT": 135,
48+
"__FIRST": 0,
49+
"__ENTITIES": [
50+
{
51+
"__KEY": "1",
52+
"__TIMESTAMP": "2019-12-01T20:18:26.046Z",
53+
"__STAMP": 5,
54+
"lastname": "ESSEAL"
55+
},
56+
{
57+
"__KEY": "2",
58+
"__TIMESTAMP": "2019-12-04T10:58:42.542Z",
59+
"__STAMP": 6,
60+
"lastname": "JONES"
61+
},
62+
...
63+
}
64+
}
65+
```
66+
67+
If you want to get all attributes from employees:
68+
69+
`GET /rest/Company(1)/?$attributes=employees.*`
70+
71+
If you want to get last name and job name attributes from employees:
72+
73+
`GET /rest/Company(1)/?$attributes=employees.lastname,employees.jobname`
74+
75+
76+
## Example with related entity
77+
78+
If we pass the following REST request for our Employee datastore class (which has several relation attributes, including "employer"):
79+
80+
81+
`GET /rest/Employee(1)?$attributes=employer.name`
82+
83+
**Response**:
84+
85+
```
86+
{
87+
"__entityModel": "Employee",
88+
"__KEY": "1",
89+
"__TIMESTAMP": "2019-12-01T20:18:26.046Z",
90+
"__STAMP": 5,
91+
"employer": {
92+
"__KEY": "1",
93+
"__TIMESTAMP": "2018-04-25T14:41:16.237Z",
94+
"__STAMP": 0,
95+
"name": "Adobe"
96+
}
97+
}
98+
```
99+
100+
If you want to get all attributes of the employer:
101+
102+
`GET /rest/Employee(1)?$attributes=employer.*`
103+
104+
If you want to get the last names of all employees of the employer:
105+
106+
`GET /rest/Employee(1)?$attributes=employer.employees.lastname`

docs/REST/$binary.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
id: binary
3+
title: $binary
4+
---
5+
6+
Pass "true" to save the BLOB as a document (must also pass `$expand={blobAttributeName}`)
7+
8+
## Description
9+
10+
`$binary` allows you to save the BLOB as a document. You must also use the [`$expand`]($expand.md) command in conjunction with it.
11+
12+
When you make the following request:
13+
14+
```
15+
GET /rest/Company(11)/blobAtt?$binary=true&$expand=blobAtt
16+
```
17+
18+
You will be asked where to save the BLOB to disk:
19+
20+
![](assets/en/REST/binary.png)
21+

0 commit comments

Comments
 (0)