주제를 구독한 사용자에게 푸쉬를 전송하기 위한 api 입니다 header에 인증 정보를 꼭 넣어주세요.
{
"result": "success",
"data": {
"success": 1,
"failed": 0
}
}
{
"result": "failed",
"reason": "유효하지 않은 키값입니다."
}
{
"result": "failed",
"reason": "존재하지 않는 주제입니다."
}
민트앱의 토픽 주제 설정에 종류가 나와있다.
curl --location --request POST 'https://push.mint-app.com/v1/push/topic' \
--header 'Accept: application/json' \
--header 'api-key: {api-key}' \
--header 'api-secret: {api-sercret}' \
--form 'user_id="1"' \
--form 'title="title"' \
--form 'body="body"' \
--form 'url="https://www.domain.com"' \
--form 'title="test 메시지"' \
--form 'reserved_date="2021-09-01 12:00:00"'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://push.mint-app.com/v1/push/topic',
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('user_id' => '1','title' => 'title','body' => 'body','url' => 'https://www.domain.com','title' => 'test 메시지','reserved_date' => '2021-09-01 12:00:00'),
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("user_id","1")
.addFormDataPart("title","title")
.addFormDataPart("body","body")
.addFormDataPart("url","https://www.domain.com")
.addFormDataPart("title","test 메시지")
.addFormDataPart("reserved_date","2021-09-01 12:00:00")
.build();
Request request = new Request.Builder()
.url("https://push.mint-app.com/v1/push/topic")
.method("POST", body)
.addHeader("Accept", "application/json")
.addHeader("api-key", "{api-key}")
.addHeader("api-secret", "{api-sercret}")
.build();
Response response = client.newCall(request).execute();