여러사람에게 푸쉬를 전송하기 위한 api 입니다 header에 인증 정보를 꼭 넣어주세요.
{
"result": "success",
"data": {
"send_count": 2
}
}
{
"result": "failed",
"reason": "잘못된 CSV 형식입니다."
}
{
"result": "failed",
"reason": "유효하지 않은 키값입니다."
}
{
"result": "failed",
"reason": "존재하지 않는 사용자입니다."
}
user_id,title,body,badge,image_url,url
1,테스트,테스트,1,https://image.com/image.jpg,https://www.domain.com
curl --location --request POST 'https://push.mint-app.com/v1/push/group/csv' \
--header 'Accept: application/json' \
--header 'api-key: {api-key}' \
--header 'api-secret: {api-sercret}' \
--form 'title="test 메시지"' \
--form 'reserved_date="2021-09-01 12:00:00"' \
--form 'file=@"/Users/test/Desktop/sample.csv"'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://push.mint-app.com/v1/push/group/csv',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('title' => 'test 메시지','reserved_date' => '2021-09-01 12:00:00','file'=> new CURLFILE('/Users/test/Desktop/sample.csv')),
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'api-key: {api-key}',
'api-secret: {api-sercret}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("title","test 메시지")
.addFormDataPart("reserved_date","2021-09-01 12:00:00")
.addFormDataPart("file","sample.csv",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("/Users/test/Desktop/sample.csv")))
.build();
Request request = new Request.Builder()
.url("https://push.mint-app.com/v1/push/group/csv")
.method("POST", body)
.addHeader("Accept", "application/json")
.addHeader("api-key", "{api-key}")
.addHeader("api-secret", "{api-sercret}")
.build();
Response response = client.newCall(request).execute();