開発ドキュメント
  • Markefan 開発ドキュメント
  • 主なAPIのサンプルコード
    • Markefanへログインする
    • Markefanへのリードのインポート
    • Markefanへのリードの高度なインポート
    • 既存キャンペーンにリードを追加する
    • リードを削除する
    • メールのステータスを取得する
    • メールの未開封/未クリックを取得する
    • リード情報を取得する
    • セグメントに属するリードを取得する
    • キャンペーン対象のリードを取得する
  • フォームスクリプト
  • サンプルアプリケーション
    • VBAサンプル
Powered by GitBook
On this page
  • HTTP種類 : POST
  • URL : /SpringRest/customer/import
  • HTTP戻り値 : JSON
  • パラメータ :
  • JSON戻り値 例:
  • サンプルコード
  • 呼び出し方法

Was this helpful?

  1. 主なAPIのサンプルコード

Markefanへのリードのインポート

CSVファイルで作成したリードデータをMarkefanのリードリストにインポートします。

HTTP種類 : POST

URL : /SpringRest/customer/import

HTTP戻り値 : JSON

パラメータ :

名 前

型

必 須

access_token

String

True

list

File

True

userId

String

True

format

String

True

format パラメータは以下のように指定します: format = name,email,gender,birthday,company_name,phone,department,role,industry,country_id,region,prefecture_id,muncipality_id

csv データのサンプルは以下の通りです: ancil,abc@gmail.com,0,1990-03-01,ABC Inc,9876543210,IT,Engineers,情報通信業,日本,北海道地方,北海道,札幌市

gender(性別)は以下のように指定してください:

0 – Male
1 – Female
2 – Other

JSON戻り値 例:

{
    "code": 200,
    "message": "save success",
    "status": "200",
    "generatedId": null,
    "generatedIds": [
        78
    ],
    "statusObject": "OK",
    "errorCode": null,
    "errorLineNumber": null,
    "errorFieldName": null,
    "errorFieldValue": null,
    "errorMessage": null
}

サンプルコード

このメソッドを使用するには、CSVファイルのパス、ユーザーID、フォーマットおよびアクセストークンを渡す必要があります。 ユーザーIDはloginAPIより取得します。フォーマットはCSVファイルのフォーマットと一致していなければなりません。 以下はこのメソッドの呼び出し例で、APIよりJSON戻り値を返します。

private String csvImport(String accessToken , File csvFile, String userId, String format) {
        try {
            HttpClient client = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost("<API_BASE_URL>/SpringRest/customer/import");
            HttpEntity entity = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
                    .addBinaryBody("list", csvFile).addTextBody("access_token", accessToken)
                    .addTextBody("userId", userId).addTextBody("format", format).build();
            httpPost.setEntity(entity);
            HTTP戻り値 response = client.execute(httpPost);
            BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
            String line = "";
            while ((line = rd.readLine()) != null) {

                return line;
            }

        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }

呼び出し方法

String Response = csvImport(new File(“98d9a7ea-8669-45e6-b141-f663c8cb35b8”, "/home/bquser/Downloads/cxm.csv"), "1",
"name,email,gender,birthday,company_name,phone,department,role,industry,country_id,region,prefecture_id,muncipality_id");
PreviousMarkefanへログインするNextMarkefanへのリードの高度なインポート

Last updated 6 years ago

Was this helpful?