Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Port dspace-7_x] resourcepolicies.md: improve layout of curl commands #286

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions resourcepolicies.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,14 @@ Return codes:
The add operation allows to initialize or replace information with new one.

To set a startDate
`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}`

```
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}'
```

```json
"id": 2844,
Expand All @@ -164,8 +171,14 @@ the add operation will result in:
```

To set a name and a description
`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}`

```
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}'
```

```json
"id": 2844,
Expand Down Expand Up @@ -207,7 +220,14 @@ With the `remove` operation, you can delete:
the other properties cannot be nullified.

To remove an embargo you can for instance use the following
`curl --data '[ { "op": "remove", "path": "/startDate" }]' -H "Authorization: Bearer ..." -H "content-type: application/json" -X PATCH ${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}`

```
curl --data '[ { "op": "remove", "path": "/startDate" }]'
-H 'Authorization: Bearer ...' \
-H 'content-type: application/json' \
-X PATCH \
'${dspace7-url}/api/authz/resourcepolicies/${resourcepolicy-id}'
```

that will transform

Expand Down Expand Up @@ -245,7 +265,14 @@ Return codes, see also general [return codes for PATCH requests](patch.md#error-
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)

To change the startDate
`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}`

```
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}'
```

For example, starting with the following item data:

Expand Down Expand Up @@ -310,9 +337,14 @@ Return codes:
Update the eperson linked by this resource policy

Sample CURL command:

```
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'
curl -X PUT '${dspace7-url}/api/authz/resourcepolicies/3/eperson' \
-H 'Authorization: Bearer eyJhbGciOiJ…' \
-H 'Content-Type:text/uri-list' \
--data '${dspace7-url}/api/eperson/epersons/ba05e3dd-aa20-4441-ac05-8ceef6f67ac7'
```

The uri-list should always contain exactly 1 eperson. This eperson will be assigned to the resource policy

Return codes:
Expand Down Expand Up @@ -342,9 +374,14 @@ Return codes:
Update the group linked by this resource policy

Sample CURL command:

```
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'
curl -X PUT '${dspace7-url}/api/authz/resourcepolicies/4/group' \
-H 'Authorization: Bearer eyJhbGciOiJ…' \
-H 'Content-Type:text/uri-list' \
--data '${dspace7-url}/api/eperson/groups/db337ae5-abd2-4a28-b4ad-918cf7779e25'
```

The uri-list should always contain exactly 1 group. This group will be assigned to the resource policy

Return codes:
Expand Down