Import Product Data Feed (PHP)

This tutorial is intended for view on larger devices.

Email Yourself a link for later

Import A Product Data Feed (PHP)

The feed_import function allows you to import a new product feed into Bronto. You can only import an entire feed once per every 24 hour period. Bronto does not support importing individual products at this time. Any products that were previously imported but are not submitted in this feed will be archived.

Start Tutorial

Prerequisites

A product data feed is a file that contains all of your products and the attributes associated with each product. Product data feeds are created and managed outside of Bronto. If you already use a product data feed for another company, such as Google, you can leverage your existing product data feed to import your product data. If you do not have a product data feed, you will need to create this file before you can import product data into Bronto.

Before you can successfully use the API to import a product data feed, you must configure your data feed import settings:

  1. Log into Bronto.
  2. Go to Tables->Products->Configure Import Feed.
  3. Select whether your file is an XML or delimited file, then set up the configuration options for the file as appropriate.

You will also need to map the product categories in your file to product fields in Bronto:

  1. Log into Bronto.
  2. Go to Tables->Products->Map Product Fields.
  3. Map each category, or header, in your file to a product field in Bronto. Make custom fields as necessary.

The code in this tutorial uses PHP version 5.3.23 and the following libraries. In order to use this example, as written, you will need to make sure your PHP environment has these libraries installed.

  • cURL http://php.net/manual/en/book.curl.php
  • JSON* http://php.net/manual/en/book.json.php

*These libraries are usually installed and enabled by default

Identify Your Catalog ID

You will need to pass the ID for your product catalog as part of the POST command. To find your catalog ID

  1. Log into Bronto.
  2. Go to Tables->Products.
  3. Locate the Products API ID.
  4. Save the ID.

Move the Product Data Feed File

If necessary, move the product data feed file to a location where the API will be able to access it.

Setup Hallmonitor Client

If you haven’t already, you need to set up Hallmonitor in order to be able to authenticate and work with Bronto’s REST API. Hallmonitor is an OAuth 2.0 compliant service that is used to request and refresh access tokens for Bronto’s APIs. You must create a client key and client secret for Hallmonitor in order to authenticate with Hallmonitor and get an API token.

  1. In the Bronto platform, navigate to Home > Settings > Data Exchange.
  2. Under the REST Integrations section, click Create New Integration.
  3. Enter a Client Name.
  4. Select the appropriate client permissions.
  5. Click Save.

A client key (ID) and secret are generated and shown on the Data Exchange page. Save the the client key and client secret shown in the REST Integrations section of the Data Exchange page. You will use it in a later step to create an API token.

Get Authentication Token

This call returns an authentication token as well as a refresh token to be used once the access token expires. You will need to use this token to access Bronto’s API.

The access token expires after 1 hour. The refresh token expires after 30 days.

Use Token To Authenticate With Bronto’s API

Each request to the external API must include an HTTP Authorization header. The header value should specify a “Bearer” authorization scheme followed by a space and then the OAuth2 access token.

A 403 Forbidden response will be returned if no authorization header is provided, if a scheme other than Bearer is specified, if the token is unknown/expired, or if the token has an insufficient scope to execute the request.

Import Product Data Feed

Use a POST call to import your feed. Make sure you provide the path to your product data feed file and the product catalog ID.

If the request is successful you receive a transaction UUID back.

Check For a Response

Check the response to see if the import was successful.


    Was this article helpful?

    Not HelpfulHelpful (+1 rating, 1 votes)
    Loading...

    We welcome your feedback!

    Please let us know how this article could be improved.
    *Name and Email are optional fields.