From 392bc87225266edddf9328105fb2eb2de06da6ea Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Fri, 15 Nov 2024 12:02:09 +0530 Subject: [PATCH] Add curl example to subscriber import docs. --- docs/docs/content/apis/import.md | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/docs/content/apis/import.md b/docs/docs/content/apis/import.md index 92b3d5e0..4345e1ce 100644 --- a/docs/docs/content/apis/import.md +++ b/docs/docs/content/apis/import.md @@ -11,7 +11,7 @@ ______________________________________________________________________ #### GET /api/import/subscribers -Retrieve the status of an import. +Retrieve the status of an ongoing import. ##### Example Request @@ -36,7 +36,7 @@ ______________________________________________________________________ #### GET /api/import/subscribers/logs -Retrieve logs related to imports. +Retrieve logs from an ongoing import. ##### Example Request @@ -63,9 +63,26 @@ Send a CSV (optionally ZIP compressed) file to import subscribers. Use a multipa | Name | Type | Required | Description | |:-------|:------------|:---------|:-----------------------------------------| | params | JSON string | Yes | Stringified JSON with import parameters. | -| file | File | Yes | File for upload. | +| file | file | Yes | File for upload. | -**`params`** (JSON string) + +#### `params` (JSON string) +| Name | Type | Required | Description | +|:----------|:---------|:---------|:-----------------------------------------------------------------------------------------------------------------------------------| +| mode | string | Yes | `subscribe` or `blocklist` | +| delim | string | Yes | Single character indicating delimiter used in the CSV file, eg: `,` | +| lists | []number | Yes | Single character indicating delimiter used in the CSV file, eg: `,` | +| overwrite | bool | Yes | Whether to overwrite the subscriber parameters including subscriptions or ignore records that are already present in the database. | + +##### Example Request + +```shell +curl -u "username:password" -X POST 'http://localhost:9000/api/import/subscribers' \ + -F 'params={"mode":"subscribe", "subscription_status":"confirmed", "delim":",", "lists":[1, 2], "overwrite": true}' \ + -F "file=@/path/to/subs.csv" +``` + +##### Example Response ```json {