Import phonebook contacts for authenticated user

POST /phonebook/import/

Import phonebook contacts for the authenticated user. The request must be a multipart/form-data POST with a single file field named file containing the CSV of contacts. The authenticated user's JWT must contain the capability phonebook.ad_phonebook to allow import.

multipart/form-data

Body Required

  • file string(binary) Required

    CSV file containing phonebook contacts

Responses

  • 200 application/json

    Phonebook import completed for the authenticated user

    Hide response attributes Show response attributes object
    • message string
    • total_rows integer

      Total rows in the CSV

    • imported_rows integer

      Successfully imported rows

    • failed_rows integer

      Failed rows

    • skipped_rows integer

      Skipped rows (validation errors)

    • error_messages array[string]

      List of error messages encountered during import

  • 400 application/json

    Bad request - missing file or invalid CSV

    Hide response attributes Show response attributes object
    • message string
    • error string
  • 401 application/json

    Unauthorized - invalid or missing JWT

    Hide response attributes Show response attributes object
    • code integer
    • message string
  • 403 application/json

    Forbidden - missing capability (phonebook.ad_phonebook)

    Hide response attributes Show response attributes object
    • code integer
    • message string
POST /phonebook/import/
curl \
 --request POST 'http://localhost:8080/phonebook/import/' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: multipart/form-data" \
 --form "file=contacts.csv" \
 --form "csv_content=name,workemail,cellphone
John Doe,john@example.com,555-1234
Jane Smith,jane@example.com,555-5678
"
Request example
{"file" => "contacts.csv", "csv_content" => "name,workemail,cellphone\nJohn Doe,john@example.com,555-1234\nJane Smith,jane@example.com,555-5678\n"}
Response examples (200)
{
  "message": "string",
  "total_rows": 42,
  "imported_rows": 42,
  "failed_rows": 42,
  "skipped_rows": 42,
  "error_messages": [
    "string"
  ]
}
Response examples (400)
{
  "message": "string",
  "error": "string"
}
Response examples (401)
{
  "code": 401,
  "message": "authorization required"
}
Response examples (403)
{
  "code": 403,
  "message": "forbidden: missing capability"
}