Skip to content

Commit 8fc754b

Browse files
authored
Merge pull request #286 from DSpace/backport-278-to-dspace-7_x
[Port dspace-7_x] resourcepolicies.md: improve layout of curl commands
2 parents 990610f + 5ff9c2e commit 8fc754b

File tree

1 file changed

+43
-6
lines changed

1 file changed

+43
-6
lines changed

resourcepolicies.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,14 @@ Return codes:
137137
The add operation allows to initialize or replace information with new one.
138138

139139
To set a startDate
140-
`curl --data '[ { "op": "add", "path": "/startDate", "value": "2019-10-31" }]' -H "Authorization: Bearer ..." -H "content-type: application/json" -X PATCH ${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}`
140+
141+
```
142+
curl --data '[ { "op": "add", "path": "/startDate", "value": "2019-10-31" }]' \
143+
-H 'Authorization: Bearer ...' \
144+
-H 'content-type: application/json' \
145+
-X PATCH \
146+
'${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}'
147+
```
141148

142149
```json
143150
"id": 2844,
@@ -164,8 +171,14 @@ the add operation will result in:
164171
```
165172

166173
To set a name and a description
167-
`curl --data '[ { "op": "add", "path": "/name", "value": "my name" }, { "op": "add", "path": "/description", "value": "my description"}]' -H "Authorization: Bearer ..." -H "content-type: application/json" -X PATCH ${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}`
168174

175+
```
176+
curl --data '[ { "op": "add", "path": "/name", "value": "my name" }, { "op": "add", "path": "/description", "value": "my description"}]' \
177+
-H 'Authorization: Bearer ...' \
178+
-H 'content-type: application/json' \
179+
-X PATCH \
180+
'${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}'
181+
```
169182

170183
```json
171184
"id": 2844,
@@ -207,7 +220,14 @@ With the `remove` operation, you can delete:
207220
the other properties cannot be nullified.
208221

209222
To remove an embargo you can for instance use the following
210-
`curl --data '[ { "op": "remove", "path": "/startDate" }]' -H "Authorization: Bearer ..." -H "content-type: application/json" -X PATCH ${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}`
223+
224+
```
225+
curl --data '[ { "op": "remove", "path": "/startDate" }]'
226+
-H 'Authorization: Bearer ...' \
227+
-H 'content-type: application/json' \
228+
-X PATCH \
229+
'${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}'
230+
```
211231

212232
that will transform
213233

@@ -245,7 +265,14 @@ Return codes, see also general [return codes for PATCH requests](patch.md#error-
245265
The replace operation allows to replace *existent* information with new one. Attempt to use the replace operation to set not yet initialized information must return an error. See [general errors on PATCH requests](patch.md)
246266

247267
To change the startDate
248-
`curl --data '[ { "op": "replace", "path": "/startDate", "value": "2020-01-01" }]' -H "Authorization: Bearer ..." -H "content-type: application/json" -X PATCH ${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}`
268+
269+
```
270+
curl --data '[ { "op": "replace", "path": "/startDate", "value": "2020-01-01" }]' \
271+
-H 'Authorization: Bearer ...' \
272+
-H 'content-type: application/json' \
273+
-X PATCH \
274+
'${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}'
275+
```
249276

250277
For example, starting with the following item data:
251278

@@ -310,9 +337,14 @@ Return codes:
310337
Update the eperson linked by this resource policy
311338

312339
Sample CURL command:
340+
313341
```
314-
curl -i -X PUT 'https://demo.dspace.org/server/api/authz/resourcepolicies/3/eperson' -H 'Authorization: Bearer eyJhbGciOiJ…' -H "Content-Type:text/uri-list" --data 'https://demo.dspace.org/server/api/eperson/epersons/ba05e3dd-aa20-4441-ac05-8ceef6f67ac7'
342+
curl -X PUT '${dspace7-url}/api/authz/resourcepolicies/3/eperson' \
343+
-H 'Authorization: Bearer eyJhbGciOiJ…' \
344+
-H 'Content-Type:text/uri-list' \
345+
--data '${dspace7-url}/api/eperson/epersons/ba05e3dd-aa20-4441-ac05-8ceef6f67ac7'
315346
```
347+
316348
The uri-list should always contain exactly 1 eperson. This eperson will be assigned to the resource policy
317349

318350
Return codes:
@@ -342,9 +374,14 @@ Return codes:
342374
Update the group linked by this resource policy
343375

344376
Sample CURL command:
377+
345378
```
346-
curl -i -X PUT 'https://demo.dspace.org/server/api/authz/resourcepolicies/4/group' -H 'Authorization: Bearer eyJhbGciOiJ…' -H "Content-Type:text/uri-list" --data 'https://demo.dspace.org/server/api/eperson/groups/db337ae5-abd2-4a28-b4ad-918cf7779e25'
379+
curl -X PUT '${dspace7-url}/api/authz/resourcepolicies/4/group' \
380+
-H 'Authorization: Bearer eyJhbGciOiJ…' \
381+
-H 'Content-Type:text/uri-list' \
382+
--data '${dspace7-url}/api/eperson/groups/db337ae5-abd2-4a28-b4ad-918cf7779e25'
347383
```
384+
348385
The uri-list should always contain exactly 1 group. This group will be assigned to the resource policy
349386

350387
Return codes:

0 commit comments

Comments
 (0)