You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Axcelerate CRM批量导入联系人API调用失败求助

Solution for Axcelerate CRM Batch Contact Import via API

It sounds like your single-request API calls are working, so the core auth and field mapping are solid—great start! The 412 error flagging missing givenName and surname suggests the API isn’t properly parsing your CSV upload. Let’s walk through the most likely fixes:

1. Confirm the API’s Batch Endpoint Requirements

First, double-check Axcelerate’s API docs for batch contact imports:

  • Does the endpoint accept CSV uploads, or does it expect a JSON array of contact objects? Many CRM APIs prefer JSON for batch operations even if they support single-object POSTs.
  • If CSV is supported, what form field name does it expect? You used api.contact, but it might be something like csv_file, contacts_csv, or simply file. Using the wrong key will make the API ignore the file entirely, leading to the "undefined fields" error.

2. Fix Postman’s Form-Data Setup

If CSV is indeed supported, adjust your Postman request to match these best practices:

  • Method: Ensure you’re using the correct HTTP method (likely POST for batch creates).
  • Body Tab: Select form-data (not raw or x-www-form-urlencoded).
  • Form Field:
    • Set the key to the exact name the API specifies (verify via docs or support).
    • For the value, choose File and upload your CSV.
  • CSV Structure: Use a minimal, clean CSV with no extra whitespace:
    givenName,surname
    Elvis,Presley
    
    Avoid quotes unless your fields contain commas, and make sure the header row matches the API’s required field names exactly (case-sensitive!).

3. Correct Request Headers

  • Don’t manually set Content-Type: multipart/form-data: Postman automatically adds this header with the necessary boundary parameter when using form-data. Manually setting it can break request parsing.
  • Keep auth headers identical to your working single request: Ensure your API key, bearer token, or other auth headers are present and correct—same as the requests that successfully synced data.

4. Test with Raw CSV Content

If form-data uploads still fail, try sending the CSV as raw text:

  • In Postman’s Body tab, select raw and set the format to Text.
  • Paste your CSV content directly into the text area.
  • Set the Content-Type header to text/csv.
  • Send the request. If this works, the issue is with how the file is being passed via form-data (likely an incorrect field name).

5. Fallback: Convert CSV to JSON Batch Request

If the API doesn’t support CSV uploads, use a simple script to convert your CSV into a JSON array of contact objects (matching your working single-request structure):

Example Python Script

import csv
import requests

# Replace with your API details
API_URL = "https://your-axcelerate-api-endpoint.com/batch-contacts"
AUTH_HEADERS = {"Authorization": "Bearer YOUR_API_TOKEN"}

# Read CSV and build contact array
contacts = []
with open("contacts.csv", mode="r") as csv_file:
    csv_reader = csv.DictReader(csv_file)
    for row in csv_reader:
        contacts.append({
            "givenName": row["givenName"],
            "surname": row["surname"]
            # Add any other required fields here
        })

# Send batch request
response = requests.post(API_URL, json=contacts, headers=AUTH_HEADERS)
print(f"Response Status: {response.status_code}")
print(f"Response Body: {response.text}")

This approach leverages the same structure that worked for your single requests, so it’s almost guaranteed to work if the API supports batch JSON submissions.

6. Debug with Curl

Use Postman’s "Code" feature (top-right corner) to generate a curl command for your request. Run this command in your terminal to rule out Postman-specific issues. For example:

curl --location --request POST 'https://api.axcelerate.com.au/v1/contacts/batch' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--form 'csv_file=@"/path/to/your/test.csv"'

If the curl command returns the same error, the issue is with the request structure, not Postman.

Content of the question originates from Stack Exchange, asked by Jason Rey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 06:49:34