Attach a resource to an application environment
POST
/api/v3/organizations/{organisation}/resources/{resource}/attachments
const url = 'https://dashboard.quantcdn.io/api/v3/organizations/test-org/resources/res-abc123/attachments';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"application":"test-app","environment":"production","envVarPrefix":"MEDIA"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://dashboard.quantcdn.io/api/v3/organizations/test-org/resources/res-abc123/attachments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "application": "test-app", "environment": "production", "envVarPrefix": "MEDIA" }'Object storage credentials are written immediately and take effect on the environment’s next deploy. Cache variables are rendered at the next deploy, so a cache may be attached while it is still provisioning. An environment accepts one attachment per resource type.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”organisation
required
string
The organisation ID
Example
test-orgresource
required
string
The resource ID
Example
res-abc123Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
application
required
string
Example
test-appenvironment
required
string
Example
productionenvVarPrefix
Namespaces every injected variable, so MEDIA yields MEDIA_S3_BUCKET
string
Example
MEDIAResponses
Section titled “Responses”The attachment
Media typeapplication/json
Resource attachment
object
appName
string
envName
string
envVarPrefix
Namespaces every injected variable, so MEDIA yields MEDIA_S3_BUCKET
string
accessKeyId
Object storage only. The secret half is written to the environment’s secrets and never returned.
string
injectedKeys
The exact variable names this attachment wrote, removed precisely on detach
Array<string>
createdAt
string format: date-time
note
When the credentials take effect
string
Example
{ "appName": "test-app", "envName": "production", "envVarPrefix": "MEDIA"}An attachment of this type already exists for the environment
