Create a repository commit - Spacefast Docs
Create a repository commit
Save file operations as one Git commit. Spacefast creates a missing hosted repository for an initial commit. Send expectedHeadSha to reject stale writes. With sourceVersionId, preserve all original upload files before applying operations. The version must be current, ready, and a direct static upload. This option requires versions and versions in addition to spaces. Use 40 zeroes for expectedHeadSha and omit base or ephemeral branches. The hosted repository must have no branches, ephemeral branches, or tags. Upload bytes and replacement contents must total at most 4 MiB, with at most 1,000 uploaded files. A commit does not confirm deployment.
Endpoint
POST /v1/spaces/{spaceId}/source/commits
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
Scopes:
spaces:write
Path parameters
spaceId: string (required)
Request body
Required
application/json
{
"author": {
"name": "string",
"email": "user@example.com"
},
"baseBranch": "string",
"commitMessage": "string",
"committer": {
"name": "string",
"email": "user@example.com"
},
"connectionType": "connected",
"ephemeral": true,
"ephemeralBase": true,
"expectedHeadSha": "string",
"operations": [
{
"action": "upsert",
"path": "string",
"contents": "string",
"encoding": "utf8"
}
],
"sourceVersionId": "string",
"targetBranch": "string"
}
Responses
201 Response for status 201
{
"$schema": "http://example.com",
"data": {
"repositoryConnection": {
"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"
},
"repositoryId": "string",
"commitSha": "string",
"treeSha": "string",
"targetBranch": "string",
"packBytes": 9007199254740991,
"blobCount": 9007199254740991,
"refUpdate": {
"branch": "string",
"oldSha": "string",
"newSha": "string"
}
}
}
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"
}