Connection
Generate a new connection
Authentication
WRITE API
- Write
READ API
- Read
PLATFORM API
- OAuth
- Project
- Provider App
- Integration
- Revision
- Installation
- Objects & Fields
- Operation
- Provider
- API Key
- Connection
- Group
- Consumer
- Destination
- Upload URL
- Org
- User
- Billing Account
Connection
Generate a new connection
For providers which support OAuth2 Authorization Code, it is recommended that you use the /oauth-connect endpoint instead, unless you already have the refresh token and are importing it into Ampersand.
POST
/
projects
/
{projectIdOrName}
/
connections:generate
curl --request POST \
--url https://api.withampersand.com/v1/projects/{projectIdOrName}/connections:generate \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '{
"providerWorkspaceRef": "<string>",
"providerMetadata": {},
"groupName": "<string>",
"groupRef": "group-123",
"consumerName": "<string>",
"consumerRef": "<string>",
"provider": "<string>",
"apiKey": "<string>",
"basicAuth": {
"username": "<string>",
"password": "<string>"
},
"oauth2ClientCredentials": {
"clientId": "<string>",
"clientSecret": "<string>",
"scopes": [
"<string>"
]
},
"oauth2PasswordCredentials": {
"username": "<string>",
"password": "<string>",
"clientId": "<string>",
"clientSecret": "<string>",
"scopes": [
"<string>"
]
},
"oauth2AuthorizationCode": {
"accessToken": {
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"issuedAt": "2023-11-07T05:31:56Z"
},
"refreshToken": {
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"issuedAt": "2023-11-07T05:31:56Z"
},
"scopes": [
"<string>"
]
}
}'
{
"id": "connection-123",
"projectId": "project-456",
"provider": "salesforce",
"providerApp": {
"id": "provider-app-123",
"projectId": "project-456",
"externalRef": "external-id-123",
"provider": "salesforce",
"clientId": "client-id-123",
"scopes": [
[
"oauth",
"offline",
"crm.read"
]
],
"createTime": "2023-11-07T05:31:56Z",
"updateTime": "2023-11-07T05:31:56Z"
},
"group": {
"groupRef": "group-123",
"groupName": "Super Customer",
"projectId": "project-456",
"createTime": "2023-07-13T21:34:44.816Z",
"updateTime": "2023-07-13T21:34:44.816Z"
},
"consumer": {
"consumerRef": "consumer-123",
"consumerName": "Super Customer",
"projectId": "project-456",
"createTime": "2023-07-13T21:34:44.816Z",
"updateTime": "2023-07-13T21:34:44.816Z"
},
"providerWorkspaceRef": "provider-workspace-123",
"providerConsumerRef": "provider-consumer-123",
"createTime": "2023-07-13T21:34:44.816Z",
"updateTime": "2023-07-13T21:34:44.816Z",
"authScheme": "oauth2/authorizationCode",
"status": "working",
"oauth2AuthorizationCode": {
"accessToken": {
"token": "<string>",
"issuedAt": "2024-04-22T18:55:28.456076Z",
"expiresAt": "2024-10-22T18:55:28.456076Z"
},
"refreshToken": {
"token": "<string>",
"issuedAt": "2024-04-22T18:55:28.456076Z",
"expiresAt": "2024-10-22T18:55:28.456076Z"
},
"scopes": [
"<string>"
]
},
"apiKey": "api-key-123",
"providerMetadata": {}
}
Authorizations
Path Parameters
The Ampersand project ID or project name.
Body
application/json
Response
201
application/json
Created
The response is of type object
.
Was this page helpful?
curl --request POST \
--url https://api.withampersand.com/v1/projects/{projectIdOrName}/connections:generate \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '{
"providerWorkspaceRef": "<string>",
"providerMetadata": {},
"groupName": "<string>",
"groupRef": "group-123",
"consumerName": "<string>",
"consumerRef": "<string>",
"provider": "<string>",
"apiKey": "<string>",
"basicAuth": {
"username": "<string>",
"password": "<string>"
},
"oauth2ClientCredentials": {
"clientId": "<string>",
"clientSecret": "<string>",
"scopes": [
"<string>"
]
},
"oauth2PasswordCredentials": {
"username": "<string>",
"password": "<string>",
"clientId": "<string>",
"clientSecret": "<string>",
"scopes": [
"<string>"
]
},
"oauth2AuthorizationCode": {
"accessToken": {
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"issuedAt": "2023-11-07T05:31:56Z"
},
"refreshToken": {
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"issuedAt": "2023-11-07T05:31:56Z"
},
"scopes": [
"<string>"
]
}
}'
{
"id": "connection-123",
"projectId": "project-456",
"provider": "salesforce",
"providerApp": {
"id": "provider-app-123",
"projectId": "project-456",
"externalRef": "external-id-123",
"provider": "salesforce",
"clientId": "client-id-123",
"scopes": [
[
"oauth",
"offline",
"crm.read"
]
],
"createTime": "2023-11-07T05:31:56Z",
"updateTime": "2023-11-07T05:31:56Z"
},
"group": {
"groupRef": "group-123",
"groupName": "Super Customer",
"projectId": "project-456",
"createTime": "2023-07-13T21:34:44.816Z",
"updateTime": "2023-07-13T21:34:44.816Z"
},
"consumer": {
"consumerRef": "consumer-123",
"consumerName": "Super Customer",
"projectId": "project-456",
"createTime": "2023-07-13T21:34:44.816Z",
"updateTime": "2023-07-13T21:34:44.816Z"
},
"providerWorkspaceRef": "provider-workspace-123",
"providerConsumerRef": "provider-consumer-123",
"createTime": "2023-07-13T21:34:44.816Z",
"updateTime": "2023-07-13T21:34:44.816Z",
"authScheme": "oauth2/authorizationCode",
"status": "working",
"oauth2AuthorizationCode": {
"accessToken": {
"token": "<string>",
"issuedAt": "2024-04-22T18:55:28.456076Z",
"expiresAt": "2024-10-22T18:55:28.456076Z"
},
"refreshToken": {
"token": "<string>",
"issuedAt": "2024-04-22T18:55:28.456076Z",
"expiresAt": "2024-10-22T18:55:28.456076Z"
},
"scopes": [
"<string>"
]
},
"apiKey": "api-key-123",
"providerMetadata": {}
}