Catalyst Integrated Import API

Follow

With this feature, users are now able to take the previously manual process of importing data and automate it. Any data capable of being imported can now be handled using our API. With a little help from your internal IT team, you can now set up a recurring feed to pass a file (xls, xlsx, or csv formats) to Catalyst for import, using all the same settings currently available (create new, update existing, etc). Follow the instructions below to get started.

Before you can set up an automatic import, you will need two pieces of information; an Access Token and an Import ID. You can get your Access Token by following the Getting the Access Token section of the Catalyst API article.

The next thing you will need is an Import ID. If you have never imported the information you are mapping with API Import, you will first need to do a manual import (this will be used later to tell the API what to do with the file you send). For directions on how to set up a manual import please see our Importing article.

Once you have a completed manual import for the section you wish to update, you will need to obtain the Import ID from it. Follow these steps to obtain the ID.

  1. Go to Administration => Import & Export
  2. Scroll down to the Import History Section
  3. Locate the completed import for the section you need and click Details next to it
  4. The Import ID will appear as the first item on this page as ID

The last step is to create an API call to Catalyst with the relevant import information (see below). API calls can be written in many different languages (AJAX, Ruby, etc.). For this part, you’ll likely need the help of your IT department.

API requests need to include a header with the key, “authorization”, and value, “Token token=[copied token key]”. The “[copied token key]” should be replaced with the Access Token from the “Obtaining Access Token” steps above.

Request Examples:

The following example is a Ruby API post

require ‘uri’
require ‘net/http’

url = URI

http = Net::HTTP.new(url.host, url.port)

file_path = “[path]”
file = File.new(file_path, “rb”)
file_data = file.read

request = Net::HTTP::Post.new(url)
request[“content-type”] = ‘multipart/form-data; boundary=—-011000010111000001101001’
request[“authorization”] = ‘Token token=[copied token key]’
request[“cache-control”] = ‘no-cache’
request[“postman-token”] = ‘fc929ad5-0b02-7175-c14d-3c4ce5d6568a’
request.body = “——-011000010111000001101001\r\nContent-Disposition: form-data; name=\“sample_import_request_id\”\r\n\r\n[id]\r\n——-011000010111000001101001\r\nContent-Disposition: form-data; name=\“payload\”; filename=\”[filename]\r\nContent-Type: application/octet-stream\r\n\r\n#{file_data}——-011000010111000001101001—”

response = http.request(request)
puts response.read_body

  • Replace “[site]” with your Catalyst site prefix.
  • Replace “[path]” with the file path, such as “C:\users\username\documents\example.xls”
  • Replace “[filename]” with the name of the file, such as Applications_15_04_21_1213.xls
  • Replace “[id]” with the Import ID.
  • Replace “[copied token key]” with your user Access Token.

The following example is a CURL API post

curl -X POST -H “Authorization: Token token=[copied token key]” -H “Content-Type: multipart/form-data; boundary=——WebKitFormBoundary7MA4YWxkTrZu0gW” -F “payload=@[path]” “https://[site].bccatalyst.com/import/api/V1/api_upload” -F ”sample_import_request_id=[id]”

  • Replace “[copied token key]” with your user Access Token.
  • Replace “[path]” with the file path, such as “C:\users\username\documents\example.xls”
  • Replace “[site]” with your Catalyst site prefix.
  • Replace “[id]” with the Import ID.
Have more questions? Submit a request

Comments