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

Was this helpful?

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

Markefanへログインする

Markefanにログインを行うAPIです。 Markefanの各APIを使用するときには、最初にこのログインAPIを用いてユーザーIDやアクセストークンを取得する必要があります。

HTTP種類 : POST

URL : [BASE URL]/SpringRest/account/user/login

パラメータ

名 前

型

必 須

Username

String

True

Password

String

True

※Passwordは、MD5でハッシュ化した値を渡します。

HTTP戻り値 : JSON

JSON戻り値 例:

{
    "code": 200,
    "message": "LOGIN SUCCESS",
    "status": "OK",
    "generatedId": null,
    "generatedIds": null,
    "statusObject": "OK",
    "account": {
        "accountId": null,
        "name": "",
        "companyName": "",
        "companyUrl": null,
        "creationDate": null
    },
    "user": {
        "userId": null,
        "name": "",
        "firstName": "",
        "lastName": "",
        "role": null
    },
    "auth": {
        "accessToken": "",
        "tokenType": "bearer",
        "refreshToken": "",
        "expiresIn": 3000,
        "scope": "[read, trust, write]"
    }
}

サンプルコード

This method used for login, you have to pass username and password as the parameter to this method and it will return the response from API. It contains users details, such as userId, accessToken etc.

private String loginApi(String username, String password) {
    try {
        HttpClient client = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost("<API_BASE_URL>/SpringRest/account/user/login");
        List<NameValuePair> Parameter = new ArrayList<NameValuePair>();
        Parameter.add(new BasicNameValuePair("username", username));
        Parameter.add(new BasicNameValuePair("password", password));
        HttpEntity entity = new UrlEncodedFormEntity(Parameter);
        httpPost.setEntity(entity);
        HTTPResponse 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 responseJson = loginApi("admin","admin");
Previous主なAPIのサンプルコードNextMarkefanへのリードのインポート

Last updated 6 years ago

Was this helpful?