https://linen.dev logo
u

Ulf Svensson

01/31/2022, 11:28 PM
Hi. I am trying to create a source for google sheets using the configuration API: https://airbyte-public-api-docs.s3.us-east-2.amazonaws.com/rapidoc-api-docs.html#post-/v1/connections/create The example schema looks like this: { "sourceDefinitionId": "17eb26bb-1d20-4000-8338-eab5bc180801", "connectionConfiguration": { "user": "charles" }, "workspaceId": "17eb26bb-1d20-4000-89b3-7a47513d8017", "name": "string" } How would that look like if I create a google sheets source using a service account?
1
h

Harshith (Airbyte)

02/01/2022, 4:33 AM
Hey I would suggest do it from UI and we would have made the same API call so you can check how it is done.
u

Ulf Svensson

02/01/2022, 7:37 AM
I have done that and exported the configuration and looked at that but could not figure it out. How can you check how the API call is done?
I have used the Configuration API call http://localhost:8000/api/v1/source_definition_specifications/get for the google sheets source definition specification ("sourceDefinitionId":"71607ba1-c0ac-4799-8049-7f4b90dd50f7"). Do you put all of this in the connectionConfiguration part of the /v1/sources/create ? Any example how to do this would be appreciated. Any type of source would be good as an example.
h

Harshith (Airbyte)

02/02/2022, 11:26 AM
You need to pass these configuration as mentioned here https://airbyte-public-api-docs.s3.us-east-2.amazonaws.com/rapidoc-api-docs.html#post-/v1/sources/create
Copy code
{
sourceDefinitionId*: uuid
connectionConfiguration*: {missing-type-info}

The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source.
workspaceId*: uuid
name*: string
}
u

Ulf Svensson

02/02/2022, 2:23 PM
I understand that but not sure if I should put in all returned from source_definition_specifications/get here {missing-type-info}.
For the google sheets the following is returned: {"sourceDefinitionId":"71607ba1-c0ac-4799-8049-7f4b90dd50f7",     "documentationUrl":"https://docs.airbyte.io/integrations/sources/google-sheets",     "connectionSpecification":{"type":"object","title":"Stripe Source Spec",         "$schema":"http://json-schema.org/draft-07/schema#",         "required":["spreadsheet_id"],         "properties":{"credentials":{"type":"object",             "oneOf":[{"type":"object",                 "title":"Authenticate via Google (Oauth)",                 "required":["auth_type","client_id","client_secret","refresh_token"],                 "properties":{"auth_type":{"type":"string",                     "const":"Client"},                     "client_id":{"type":"string",                         "title":"Client ID",                         "description":"The Client ID of your developer application",                         "airbyte_secret":true},                         "client_secret":{"type":"string",                             "title":"Client Secret",                             "description":"The client secret of your developer application","airbyte_secret":true},"refresh_token":{"type":"string",                                 "title":"Refresh Token",                                 "description":"A refresh token generated using the above client ID and secret","airbyte_secret":true}}},                                 {"type":"object",                                     "title":"Service Account Key Authentication",                                     "required":["auth_type","service_account_info"],                                     "properties":{"auth_type":{"type":"string",                                         "const":"Service"},                                         "service_account_info":{"type":"string",                                             "examples":["{ \"type\": \"service_account\", \"project_id\": YOUR_PROJECT_ID, \"private_key_id\": YOUR_PRIVATE_KEY, ... }"],                                             "description":"The JSON key of the service account to use for authorization","airbyte_secret":true}}}]},                                             "spreadsheet_id":{"type":"string",                                                 "description":"The ID of the spreadsheet to be replicated."}},"additionalProperties":true},                                                 "authSpecification":{"auth_type":"oauth2.0",                                                     "oauth2Specification":{"rootObject":["credentials","0"],"oauthFlowInitParameters":[["client_id"],["client_secret"]],"oauthFlowOutputParameters":[["refresh_token"]]}},                                                     "advancedAuth":null,                                                     "jobInfo":{"id":"2b8e36c7-fa84-4abd-8342-ce62bf673ee9","configType":"get_spec",                                                         "configId":"Optional.empty",                                                         "createdAt":1643798369876,"endedAt":1643798369876,                                                         "succeeded":true,                                                         "logs":{"logLines":[]}}}
2 Views