### Accessing V3 API Endpoints Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Provides an example of how to use the `OAuthConnection` object to access V3 API endpoints. It demonstrates making a GET request with query parameters like `include_fields` and `limit`. ```python v3client = bigcommerce.connection.OAuthConnection(client_id=client_id, store_hash=store_hash, access_token=access_token, api_path='/stores/{}/v3/{}') v3client.get('/catalog/products', include_fields='name,sku', limit=5, page=1) ``` -------------------------------- ### Accessing GraphQL Admin API Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Shows how to use the `GraphQLConnection` client to interact with the GraphQL Admin API. Includes examples for executing a basic query and fetching the introspection schema. ```python gql = bigcommerce.connection.GraphQLConnection( client_id=client_id, store_hash=store_hash, access_token=access_token ) # Make a basic query time_query_result = gql.query(""" query { system { time } } """) # Fetch the schema schema = gql.introspection_query() ``` -------------------------------- ### Accessing Subresources Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Demonstrates how to access subresources, both as independent resources and as helper methods on the parent resource. This includes getting specific subresources and performing CRUD operations on them. ```python api.ProductOptions.get(1) # GET /products/1/options api.ProductOptions.get(1, 2) # GET /products/1/options/2 api.Products.get(1).options() # GET /products/1/options api.Products.get(1).options(1) # GET /products/1/options/1 api.Products.get(1).options(1).delete() ``` -------------------------------- ### Accessing API Resources (CRUD Operations) Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Shows common CRUD operations for API resources like Products. Includes methods for fetching all items, iterating through all items with autopaging, getting a single item, creating, updating, deleting, and counting resources. ```python api.Products.all() # GET /products (returns only a single page of products as a list) api.Products.iterall() # GET /products (autopaging generator that yields all # products from all pages product by product.) api.Products.get(1) # GET /products/1 api.Products.create(name='', type='', ...) # POST /products api.Products.get(1).update(price='199.90') # PUT /products/1 api.Products.delete_all() # DELETE /products api.Products.get(1).delete() # DELETE /products/1 api.Products.count() # GET /products/count ``` -------------------------------- ### Connecting to Bigcommerce API (OAuth) Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Demonstrates how to establish a connection to the Bigcommerce API using OAuth for public applications. It shows the initialization of the BigcommerceApi object with client ID, store hash, and access token. ```python import bigcommerce # Public apps (OAuth) # Access_token is optional, if you don't have one you can use oauth_fetch_token (see below) api = bigcommerce.api.BigcommerceApi(client_id='', store_hash='', access_token='') ``` -------------------------------- ### Bigcommerce API Initialization with Rate Limiting Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Initializes the Bigcommerce API client with specified credentials and configures rate limiting management. The `min_requests_remaining` parameter controls when rate limiting is triggered, `wait` enables automatic sleeping, and `callback_function` allows custom handling of rate limiting events. ```python api = bigcommerce.api.BigcommerceApi(client_id='YOUR_CLIENT_ID', store_hash='YOUR_STORE_HASH', access_token='YOUR_ACCESS_TOKEN', rate_limiting_management= { 'min_requests_remaining': 2, 'wait': True, 'callback_function': None, 'callback_args': {} }) ``` -------------------------------- ### Connecting to Bigcommerce API (Basic Auth) Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Illustrates how to connect to the Bigcommerce API using Basic Authentication, typically for private applications. It requires the store's host, username, and API token. ```python api = bigcommerce.api.BigcommerceApi(host='store.mybigcommerce.com', basic_auth=('username', 'api token')) ``` -------------------------------- ### Bigcommerce API Documentation Reference Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Provides links to the full Bigcommerce API documentation on the Developer Portal. This section also outlines future development tasks, such as automatic enumeration of paginated subresource responses. ```APIDOC Full documentation of the API is available on the Bigcommerce `Developer Portal `__ To do: - Automatic enumeration of multiple page responses for subresources. ``` -------------------------------- ### Applying Filters to API Requests Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Explains how to apply filters to API requests using keyword arguments with the `all` method. This allows for targeted data retrieval based on specific criteria. ```python customer = api.Customers.all(first_name='John', last_name='Smith')[0] orders = api.Orders.all(customer_id=customer.id) ``` -------------------------------- ### Python Code Styleguide Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/CONTRIBUTING.md Specifies that all Python code contributed to the project must adhere to the PEP8 Python Code Styleguide. ```python All Python must adhere to [PEP8 Python Code Styleguide](https://www.python.org/dev/peps/pep-0008/). ``` -------------------------------- ### BigCommerce API Documentation Reference Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/CONTRIBUTING.md Provides a link to the official BigCommerce API documentation, serving as a reference for developers working with the API. ```APIDOC API Documentation: https://developer.bigcommerce.com/api ``` -------------------------------- ### OAuth Helper Methods Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Details the helper methods provided by BigcommerceApi for OAuth2 connections. `oauth_fetch_token` retrieves an access token, and `oauth_verify_payload` validates signed payloads. ```python # Fetches and returns an access token for your application. # As a side effect, configures `api` to be ready for use. api.oauth_fetch_token(client_secret, code, context, scope, redirect_uri) # Returns user data from a signed payload. BigcommerceApi.oauth_verify_payload(signed_payload, client_secret) ``` -------------------------------- ### Pull Request Guidelines Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/CONTRIBUTING.md Instructions for submitting pull requests to the BigCommerce Python API client repository. Emphasizes using templates, including visual aids, and ensuring files end with a newline. ```git Fill in the required template: https://github.com/bigcommerce/bigcommerce-api-python/pull/new/master Include screenshots and animated GIFs in your pull request whenever possible. End files with a newline. ``` -------------------------------- ### Rate Limiting Management Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Explains how to enable automatic rate limiting management by passing a `rate_limiting_management` object to the `BigcommerceApi` or `OAuthConnection` constructors. ```python import bigcommerce # Example usage (assuming rate_limiting_management object is defined elsewhere) # api = bigcommerce.api.BigcommerceApi(..., rate_limiting_management=my_rate_limiter) # v3client = bigcommerce.connection.OAuthConnection(..., rate_limiting_management=my_rate_limiter) ``` -------------------------------- ### Git Commit Message Styleguide Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/CONTRIBUTING.md Standards for writing Git commit messages, focusing on present tense, imperative mood, line length limits, and referencing related issues or pull requests. ```git Use the present tense ("Add feature" not "Added feature") Use the imperative mood ("Move cursor to..." not "Moves cursor to...") Limit the first line to 72 characters or less Reference pull requests and external links liberally ``` -------------------------------- ### Bigcommerce API Exception Hierarchy Source: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/README.rst Outlines the exception hierarchy for handling API errors. Different status codes (3xx, 4xx, 5xx) map to specific exception types like `RedirectionException`, `ClientRequestException`, and `ServerException`. ```python # 3xx status code: RedirectionException # 4xx status code: ClientRequestException # 5xx status code: ServerException ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.