|
| 1 | +--- |
| 2 | +title: Migrations | GitHub API |
| 3 | +--- |
| 4 | + |
| 5 | +# Migrations |
| 6 | + |
| 7 | +* TOC |
| 8 | +{:toc} |
| 9 | + |
| 10 | +{{#tip}} |
| 11 | + |
| 12 | + To access the Migrations API, you must provide a custom [media type](/v3/media) in the `Accept` header: |
| 13 | + |
| 14 | + application/vnd.github.wyandotte-preview+json |
| 15 | + |
| 16 | +{{/tip}} |
| 17 | + |
| 18 | +## Start a migration |
| 19 | + |
| 20 | +Initiates the generation of a migration archive. |
| 21 | + |
| 22 | + POST /orgs/:org/migrations |
| 23 | + |
| 24 | +### Parameters |
| 25 | + |
| 26 | +Name | Type | Description |
| 27 | +--------|---------|-------------- |
| 28 | +`repositories` | `array` of `strings` | **Required**. A list of arrays indicating which repositories should be migrated. |
| 29 | +`lock_repositories`|`boolean` | Indicates whether repositories should be locked (to prevent manipulation) while migrating data. Default: `false`. |
| 30 | + |
| 31 | +### Example |
| 32 | + |
| 33 | +<%= json \ |
| 34 | + :repositories => ["octocat/Hello-World"], |
| 35 | + :lock_repositories => true |
| 36 | +%> |
| 37 | + |
| 38 | +### Response |
| 39 | + |
| 40 | +<%= headers 201 %> |
| 41 | +<%= json(:migrations) %> |
| 42 | + |
| 43 | +## Get a list of migrations |
| 44 | + |
| 45 | +Lists the most recent migrations. |
| 46 | + |
| 47 | + GET /orgs/:org/migrations |
| 48 | + |
| 49 | +### Response |
| 50 | + |
| 51 | +<%= headers 200, :pagination => default_pagination_rels %> |
| 52 | +<%= json(:migrations) { |h| [h] } %> |
| 53 | + |
| 54 | +## Get the status of a migration |
| 55 | + |
| 56 | +Fetches the status of a migration. |
| 57 | + |
| 58 | + GET /orgs/:org/migrations/:id |
| 59 | + |
| 60 | +### Response |
| 61 | + |
| 62 | +The `state` of a migration can be one of the following values: |
| 63 | + |
| 64 | +* `pending`, which means the migration hasn't started yet. |
| 65 | +* `exporting`, which means the migration is in progress. |
| 66 | +* `exported`, which means the migration finished successfully. |
| 67 | +* `failed`, which means the migration failed. |
| 68 | + |
| 69 | +<%= hea
6217
ders 200 %> |
| 70 | +<%= json(:migrations) { |h| h['state'] = 'exported'; h } %> |
| 71 | + |
| 72 | +## Download a migration archive |
| 73 | + |
| 74 | +Fetches the URL to a migration archive. |
| 75 | + |
| 76 | + GET /orgs/:org/migrations/:id/archive |
| 77 | + |
| 78 | +### Response |
| 79 | + |
| 80 | +<%= headers 302 %> |
| 81 | +<pre class="body-response"><code> |
| 82 | +https://s3.amazonaws.com/github-cloud/migration/79/67?response-content-disposition=filename%3D0b989ba4-242f-11e5-81e1.tar.gz&response-content-type=application/x-gzip |
| 83 | +</code></pre> |
| 84 | + |
| 85 | +## Delete a migration archive |
| 86 | + |
| 87 | +Deletes a previous migration archive. Migration archives are automatically deleted after seven days. |
| 88 | + |
| 89 | + DELETE /orgs/:org/migrations/:id/archive |
| 90 | + |
| 91 | +### Response |
| 92 | + |
| 93 | +<%= headers 204 %> |
| 94 | + |
| 95 | +## Unlock a repository |
| 96 | + |
| 97 | +Unlocks a repository that was locked for migration. You should unlock each migrated repository and [delete them](/v3/repos/#delete-a-repository) when the migration is complete and you no longer need the source data. |
| 98 | + |
| 99 | + DELETE /orgs/:org/migrations/:id/repos/:repo_name/lock |
| 100 | + |
| 101 | +### Response |
| 102 | + |
| 103 | +<%= headers 204 %> |
0 commit comments