Braeden Stamas
10/27/2024, 11:04 PMuser
10/27/2024, 11:04 PMyaml version: "0.1.0" definitions: # Define reusable objects here streams: - name: orders primary_key: id schema: # Define the schema for orders incremental_sync: # Define incremental sync behavior data_retriever: requester: url_base: "<https://example.com/wp-json/wc/v3>" path: "/orders" http_method: "GET" authenticator: type: OAuth2Authenticator token_refresh_endpoint: # Specify the endpoint client_id: "{{ config['client_id'] }}" client_secret: "{{ config['client_secret'] }}" refresh_token: "{{ config['refresh_token'] }}" pagination: # Define pagination strategy record_selector: # Define how to extract records from the response - name: order_notes primary_key: id schema: # Define the schema for order notes data_retriever: requester: url_base: "<https://example.com/wp-json/wc/v3>" path: "/orders/{{ stream_partition.order }}/notes" http_method: "GET" authenticator: # Same as orders stream parent_stream: parent_key: id partition_field: order check: # Define connection checker spec: # Define connector specification
This configuration is based on the examples provided in the [Connector Builder UI Partitioning documentation](https://docs.airbyte.com/connector-development/connector-builder-ui/partitioning#example-1). A few key points to note: 1. The url_base
should be set to your WooCommerce store's API endpoint. 2. The authenticator
should be configured with OAuth2, as WooCommerce uses OAuth for authentication. 3. The order_notes
stream uses dynamic partitioning based on the parent orders
stream. 4. The path
for the order_notes
stream includes a variable {{ stream_partition.order }}
which will be replaced with the actual order ID. Remember to adjust the schema, pagination, and other details according to your specific WooCommerce setup and the data you want to extract. For more detailed information on setting up the WooCommerce source connector, you can refer to the [WooCommerce Source documentation](https://docs.airbyte.com/integrations/sources/woocommerce#connector-specific-features--highlights).Braeden Stamas
10/27/2024, 11:07 PMuser
10/27/2024, 11:08 PMHttpRequester
with a BasicHttpAuthenticator
. Here's what the YAML structure should look like: yaml requester: type: HttpRequester url_base: "<https://api.example.com>" path: "/endpoint" http_method: GET authenticator: type: BasicHttpAuthenticator username: "{{ config['username'] }}" password: "{{ config['password'] }}"
Let's break down the key components: 1. The requester
is of type HttpRequester
[as defined in the Airbyte documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/requester). 2. url_base
is the root URL of your API. 3. path
is the specific endpoint you're accessing. 4. http_method
is typically GET for fetching data, but could be POST or another method depending on your API. 5. The authenticator
is where you specify the basic authentication: - type: BasicHttpAuthenticator
indicates you're using basic HTTP authentication. - username
and password
fields use the {{ config['field_name'] }}
syntax to reference values that will be provided by the user when configuring the connector. This structure follows the [BasicHttpAuthenticator schema](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/authentication#basichttpauthenticator) as defined in the Airbyte documentation. Remember, when using this authenticator, Airbyte will automatically encode the username and password and set the "Authorization" header with the value Basic {encoded credentials}
for each request.Braeden Stamas
10/27/2024, 11:09 PMuser
10/27/2024, 11:09 PMuser
10/27/2024, 11:09 PM:
and encoded using the base64 algorithm." For example, if we have: - Username: user - Password: passwd The unencoded credentials would look like this: user:passwd
This string is then base64 encoded to create the final value for the Authorization header. It's important to note that even if only a username is required (with no password), the format still includes the colon. For instance, if you're using an API key as the username with no password, it would look like this: api_key:
This format ensures compatibility with APIs that use Basic HTTP authentication, whether they require both a username and password or just a single credential like an API key.Braeden Stamas
10/27/2024, 11:29 PMuser
10/27/2024, 11:30 PMuser
10/27/2024, 11:30 PMBasicHttpAuthenticator
which automatically sets the "Authorization" header with the base64 encoded credentials. As stated in the [Airbyte documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/authentication#basichttpauthenticator): "The BasicHttpAuthenticator
set the "Authorization" header with a (USER ID/password) pair, encoded using base64 as per RFC 7617." 2. For Bearer Token Authentication: Airbyte uses the BearerAuthenticator
which automatically sets the "Authorization" header with the Bearer token. The [documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/authentication#bearerauthenticator) states: "The BearerAuthenticator
is a specialized ApiKeyAuthenticator
that always sets the header "Authorization" with the value Bearer {token}
." 3. For API Key Authentication: The ApiKeyAuthenticator
can be configured to set any header, including "Authorization", with the API key value. Furthermore, the [Airbyte documentation on request options](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/request-options#authenticators) confirms this behavior: "It is also possible for authenticators to set request parameters or headers as needed. For instance, the BearerAuthenticator
will always set the Authorization
header." In summary, yes, Airbyte naturally injects the Authorization header into API requests when using its built-in authentication mechanisms. This is handled automatically by the appropriate authenticator based on the authentication method you've configured for your connector.Braeden Stamas
10/27/2024, 11:31 PMuser
10/27/2024, 11:31 PMuser
10/27/2024, 11:31 PMLOG_LEVEL=DEBUG
. - For one-off checks, you can monitor the network tab in the browser dev tools. 3. The Authorization header is automatically injected by Airbyte's authentication mechanisms, as we discussed earlier. For example, the BearerAuthenticator
always sets the Authorization
header with the value Bearer <token>
[as documented here](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/authentication#bearerauthenticator). Given this information, it appears that Airbyte does not explicitly show the Authorization header during connector testing for security reasons. If you need to verify the exact contents of the Authorization header, you might need to use external tools or methods to intercept and inspect the network requests made by Airbyte.