Extracting the Initial Catalog
Centra has unique product identifiers that Global-e uses to manage operations. Because some of these identifiers do not exist in Centra's native catalog export, merchants must extract the catalog on their own using the Python method. The Python method is used to retrieve the required catalog information. Note that the initial catalog upload cannot be completed correctly without providing this information.
The following shows the Python extraction method:
from time import sleep import requests import csv # Define the URL for the Centra Checkout API api_url = "https://temp.centraqa.com/graphql" api_token = "123456789abc" # Replace with your actual API token # Define the headers for the API request headers = { "Authorization": f"Bearer {api_token}", "Content-Type": "application/json" } count_index = 1 # Define the CSV file name csv_file = "centra_catalog5.csv" # Define the CSV headers csv_headers = ["Product Unique Identifier", "SKU", "Display Name", "Product Description", "Country of Origin"] # Write data to the CSV file with open(csv_file, mode='w', newline='', encoding='utf-8') as file: writer = csv.writer(file) writer.writerow(csv_headers) while True: # Define the query with variables query = """ query productList( $status: [ProductStatus!]! $page: Int! ) { products( where: { status: $status } sort: [updatedAt_DESC] limit: 30 page: $page ) { id countryOfOrigin { code } displays(where: { storeId: 1 }) { name description displayItems { id productVariant { productSizes { id SKU } } } } } } """ variables = {"status": "ACTIVE", "page": count_index} response = requests.post(api_url, json={"query": query, "variables": variables}, headers=headers) response_data = response.json() print(response_data) for product in response_data['data']['products']: for display in product['displays']: for display_item in display['displayItems']: for product_sizes in display_item['productVariant']['productSizes']: if product['displays']: product_id = product_sizes['id'] sku = product_sizes['SKU'] display_name = display['name'] description = display['description'] country_of_origin = 'N/A' if product['countryOfOrigin']: country_of_origin = product['countryOfOrigin']['code'] writer.writerow([product_id, sku, display_name, description, country_of_origin]) sleep(1) print("page: " + str(count_index)) count_index = count_index + 1