List the repositories a connection can see
Asks the git provider for the repositories the connection's account can see, most recently updated first, at most 50. q searches part of their names. You must be someone who may deploy the site.
GET/ api/ corestack/ sites/ {site}/ deployments/ repositories
Path parameters
siteintegerRequired
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
Query parameters
connectionintegerRequired
The id of a repository connection you may use on this site, as the settings list them in connections.
qstring
Part of a repository's name. Up to 100 characters.
Returns
200 The repositories.
Fields of the 200 answer
repositoriesarray of objectsRequired
Up to 50 items.
Fields of each item
adminbooleanRequired
True when the connection's account can manage webhooks on the repository, which connecting it needs.
default_branchstring or nullRequired
namestringRequired
repostringRequired
The repository as owner/name, as the repository endpoint takes it.
urlstring or nullRequired
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | none | Check the id. You see only what your account can reach. |
409 | needs_reauth | The repository's connection is gone or needs authorising again. Reconnect the repository. |
422 | invalid | Fix the field named in field; errors says why. |
429 | rate_limited | Wait for the seconds in Retry-After. |
502 | none | Read the message; it says what happened. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl 'https://manage.corefinity.com/api/corestack/sites/1042/deployments/repositories?connection=4217' \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json"use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->get('https://manage.corefinity.com/api/corestack/sites/1042/deployments/repositories?connection=4217');
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/deployments/repositories?connection=4217', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
},
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.get(
"https://manage.corefinity.com/api/corestack/sites/1042/deployments/repositories?connection=4217",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
)
data = res.json() if res.content else None{
"repositories": [
{
"admin": true,
"default_branch": "main",
"name": "harbourandfinch",
"repo": "northwind-digital/harbourandfinch",
"url": "https://gitlab.example.com/northwind-digital/harbourandfinch"
},
{
"admin": false,
"default_branch": "main",
"name": "harbourandfinch-theme",
"repo": "northwind-digital/harbourandfinch-theme",
"url": "https://gitlab.example.com/northwind-digital/harbourandfinch-theme"
}
]
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"message": "Not found."
}{
"code": "needs_reauth",
"message": "The GitLab connection needs re-authorising",
"reason": "needs_reauth"
}{
"code": "invalid",
"errors": {
"connection": [
"The connection field is required."
]
},
"field": "connection",
"message": "The connection field is required.",
"reason": "invalid"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}{
"message": "GitLab did not answer. Try again."
}Try it
Was this helpful?