Skip to content

Commit c63ac6e

Browse files
committed
Add documentation for initiating image account transfers
1 parent 011e28d commit c63ac6e

File tree

6 files changed

+129
-0
lines changed

6 files changed

+129
-0
lines changed

specification/DigitalOcean-public.v2.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,10 @@ paths:
14051405
delete:
14061406
$ref: "resources/images/images_delete.yml"
14071407

1408+
/v2/images/{image_id}/account_transfer:
1409+
post:
1410+
$ref: "resources/images/images_account_transfer_create.yml"
1411+
14081412
/v2/images/{image_id}/actions:
14091413
get:
14101414
$ref: "resources/images/imageActions_list.yml"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
lang: cURL
2+
source: |-
3+
# transfer to email
4+
curl -X POST \
5+
-H "Content-Type: application/json" \
6+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
7+
-d '{"recipient_email": "alice@example.com"}' \
8+
"https://api.digitalocean.com/v2/images/7555620/account_transfer"
9+
10+
# transfer to team
11+
curl -X POST \
12+
-H "Content-Type: application/json" \
13+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
14+
-d '{"recipient_uuid": "4f6c71e2-1e90-4762-9fee-6cc4a0a9f2cf"}' \
15+
"https://api.digitalocean.com/v2/images/9375231/account_transfer"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
operationId: images_account_transfer_create
2+
3+
summary: Initiate an Image Account Transfer
4+
5+
description: |
6+
To initiate an account transfer for an image, send a POST request to
7+
/v2/images/$IMAGE_ID/account_transfer.
8+
9+
Only snapshot images may be transferred by this endpoint to another account.
10+
11+
An image account transfer always has exactly one recipient, specified in the request body.
12+
The recipient can be one of the following:
13+
14+
* A DigitalOcean account, denoted by `recipient_email` in the request body.
15+
The recipient will receive an email with instructions to accept the transfer.
16+
Once the recipient accepts the transfer, the image will be moved to their
17+
account.
18+
19+
* A DigitalOcean team, denoted by `recipient_uuid` in the request body. If the
20+
user has sufficient permissions in the recipient team, the transfer will be
21+
automatically accepted and the image will be moved to the recipient team's
22+
account. Otherwise, the transfer will be pending until a user with sufficient
23+
permissions in the recipient team accepts the transfer.
24+
tags:
25+
- Images
26+
27+
parameters:
28+
- $ref: 'parameters.yml#/image_id'
29+
30+
requestBody:
31+
required: true
32+
33+
content:
34+
application/json:
35+
schema:
36+
$ref: 'models/images_account_transfer_create.yml'
37+
38+
responses:
39+
'201':
40+
$ref: 'responses/images_account_transfer_created.yml'
41+
42+
'400':
43+
$ref: '../../shared/responses/bad_request.yml'
44+
45+
'401':
46+
$ref: '../../shared/responses/unauthorized.yml'
47+
48+
'404':
49+
$ref: '../../shared/responses/not_found.yml'
50+
51+
'500':
52+
$ref: '../../shared/responses/server_error.yml'
53+
54+
default:
55+
$ref: '../../shared/responses/unexpected_error.yml'
56+
57+
x-codeSamples:
58+
- $ref: 'examples/curl/images_account_transfer_create.yml'
59+
60+
security:
61+
- bearer_auth:
62+
- 'image:update'
63+
- 'image:delete'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
oneOf:
2+
- title: Transfer To Email
3+
type: object
4+
properties:
5+
recipient_email:
6+
type: string
7+
example: alice@example.com
8+
description: The email address of the user account that the image will be transferred to.
9+
required:
10+
- recipient_email
11+
12+
- title: Transfer To Team
13+
type: object
14+
properties:
15+
recipient_uuid:
16+
type: string
17+
example: 4f6c71e2-1e90-4762-9fee-6cc4a0a9f2cf
18+
description: The UUID of the team that the image will be transferred to.
19+
required:
20+
- recipient_uuid
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type: integer
2+
description: |
3+
A unique number that can be used to identify and reference an image
4+
account transfer.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
description: >-
2+
The response will be a JSON object with a key called `transfer_id`.
3+
The value of this will be a number that identifies the initiated transfer. If
4+
the value is `0`, then the transfer has been accepted. Otherwise, the
5+
transfer is pending and waiting for the recipient to accept it.
6+
7+
headers:
8+
ratelimit-limit:
9+
$ref: '../../../shared/headers.yml#/ratelimit-limit'
10+
ratelimit-remaining:
11+
$ref: '../../../shared/headers.yml#/ratelimit-remaining'
12+
ratelimit-reset:
13+
$ref: '../../../shared/headers.yml#/ratelimit-reset'
14+
15+
content:
16+
application/json:
17+
schema:
18+
properties:
19+
transfer_id:
20+
$ref: '../models/transfer_id.yml'
21+
22+
example:
23+
transfer_id: 3164444

0 commit comments

Comments
 (0)