Create a source connection - Spacefast Docs
Create a source connection
Creates a source connection. It replaces an existing connection only after you close its source workspaces.
POST /v1/spaces/{spaceId}/source/connection
Authorization
Authorization: Bearer <token>
with an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).
or
Authorization: OAuth2 access token
OAuth 2.0 with Spacefast scopes. People use the authorization code flow; machines use client credentials.
Scopes:
spaces:write
Path parameters
spaceIdstring(required)
Request body (required)
Content-Type: application/json
JSON Body:
{
"provider": "string",
"connectionType": "string",
"repositoryId": "string",
"repositoryName": "string",
"repositoryFullName": "string",
"defaultBranch": "string",
"productionBranch": "string",
"cloneUrl": "string",
"upstreamUrl": "string",
"installationId": "string",
"credential": "string",
"autoDeployProduction": true,
"autoDeployPreviews": true,
"buildSettings": {
"rootDirectory": "string",
"installDirectory": "string",
"installCommand": "string",
"buildCommand": "string",
"outputDirectory": "string",
"ignoredBuildCommand": "string",
"frameworkPreset": "string",
"platformPreset": "string",
"allowUnsupportedPlatformFeatures": true,
"timeoutSeconds": 60
}
}
Example Request
cURL:
curl -X POST "https://api.spacefast.com/v1/spaces/string/source/connection" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"provider": "github",
"connectionType": "connected",
"repositoryId": "string",
"repositoryName": "string",
"repositoryFullName": "string",
"defaultBranch": "main",
"productionBranch": "string",
"cloneUrl": "string",
"upstreamUrl": "string",
"installationId": "string",
"credential": "string",
"autoDeployProduction": true,
"autoDeployPreviews": true,
"buildSettings": {
"rootDirectory": "string",
"installDirectory": "string",
"installCommand": "string",
"buildCommand": "string",
"outputDirectory": "string",
"ignoredBuildCommand": "string",
"frameworkPreset": "string",
"platformPreset": "string",
"allowUnsupportedPlatformFeatures": true,
"timeoutSeconds": 60
}
}'
Responses
201 Response for status 201
{
"$schema": "http://example.com",
"data": {
"id": "string",
"spaceId": "string",
"provider": "github",
"connectionType": "connected",
"repositoryId": "string",
"installationId": null,
"cloneUrlConfigured": false,
"upstreamUrlConfigured": false,
"repositoryName": "string",
"repositoryFullName": "string",
"defaultBranch": "string",
"productionBranch": "string",
"credentialConfigured": true,
"autoDeployProduction": true,
"autoDeployPreviews": true,
"buildSettings": {
"rootDirectory": null,
"installDirectory": null,
"installCommand": null,
"buildCommand": null,
"outputDirectory": null,
"ignoredBuildCommand": null,
"frameworkPreset": null,
"platformPreset": null,
"allowUnsupportedPlatformFeatures": false,
"timeoutSeconds": 900
},
"syncStatus": "idle",
"providerAccessStatus": "active",
"providerAccessError": null,
"lastSyncedAt": "2019-08-24T14:15:22Z",
"lastSyncError": "string",
"syncRunId": "string",
"connectedUserId": "string",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
}
Error Response
{
"$schema": "http://example.com",
"type": "string",
"title": "string",
"status": -9007199254740991,
"detail": "string",
"code": "string",
"pointer": "string",
"details": {
"property1": null,
"property2": null
},
"suggestions": [
"string"
],
"next": [
"string"
],
"requestId": "string"
}