API 사용하기
엔드포인트
- https://api.widsign.com (2021-08-03 이후 신규 API 사용자)
- https://api.eform.io (기존 API 사용자)
액세스 토큰
이전 섹션에서 설명드린대로 API_ID, API_KEY 를 발급받으신 후에 액세스토큰을 요청하는 API 를 호출하시면 됩니다.
REQUEST
curl --location --request GET 'https://api.widsign.com/v2/token' \
--header 'x-api-id: {{API_ID}}' \
--header 'x-api-key: {{API_KEY}}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.widsign.com/v2/token")
.method("GET", null)
.addHeader("x-api-id", "{{API_ID}}")
.addHeader("x-api-key", "{{API_KEY}}")
.build();
Response response = client.newCall(request).execute();
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.widsign.com/v2/token',
'headers': {
'x-api-id': '{{API_ID}}',
'x-api-key': '{{API_KEY}}'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.widsign.com/v2/token');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-id' => '{{API_ID}}',
'x-api-key' => '{{API_KEY}}'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
var client = new RestClient("https://api.widsign.com/v2/token");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-id", "{{API_ID}}");
request.AddHeader("x-api-key", "{{API_KEY}}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
액세스 토큰 만료시간
발급받은 액세스 토큰의 만료시간은 10분이며 만료되면 다시 발급받아야 합니다.
RESPONSE
응답 mime type 은 application/json 입니다
access_token 키의 값이 액세스 토큰입니다.
{
"svc_owner_id": 70573,
"access_token": "1yJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Miwic3ZjX293bmVyX2lkIjoxMDAwNzAsImFjY2Vzc19AZXlfaWQiOiJWZ24yYURoUmRKIiwiaWF0IjoxNTk5ODgzNzI2LCJleHAiOjE1OTk4ODQzMjZ9.afWBODskCFhG38YohzEdkZbF9Bs8Z9GhUKcBSDGrqneVIc7eY3ZcE6aGGyd55hi1ROr_Qeg6jM83BZaIGSiy1qR_JXKqnzQqr3ocHlng2_q1k9DylCMwK32hu_HawWr1q7hkCuOfpmR62FObz0NkV0Q-xSvcp1aIgXD1t9Y5Kr8"
}
API 요청
발급받은 액세스 토큰을 사용해서 다른 API를 호출합니다.
REQUEST
폼 목록 조회
curl --location --request GET 'https://api.widsign.com/v2/form' \
--header 'x-api-key: {{API_KEY}}' \
--header 'x-access-token: {{ACCESS_TOKEN}}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.widsign.com/v2/form")
.method("GET", null)
.addHeader("x-api-key", "{{API_KEY}}")
.addHeader("x-access-token", "{{ACCESS_TOKEN}}")
.build();
Response response = client.newCall(request).execute();
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.widsign.com/v2/form',
'headers': {
'x-api-key': '{{API_KEY}}',
'x-access-token': 'ACCESS_TOKEN'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.widsign.com/v2/form');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'x-api-key' => '{{API_KEY}}',
'x-access-token' => '{{ACCESS_TOKEN}}'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
var client = new RestClient("https://api.widsign.com/v2/form");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "{{API_KEY}}");
request.AddHeader("x-access-token", "{{ACCESS_TOKEN}}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
RESPONSE
{
"svc_owner_id": 70573,
"total_count": 403,
"page_size": 30,
"page_count": 14,
"page": 1,
"result": [
{
"id": "1f5b0683c1ac323565a79672",
"title": "연월차 사용계획서",
"created_date": "2020-09-11 14:09:23"
},
{
"id": "2f5959b7b1702745eeed950a",
"title": "단기 아르바이트 고용계약",
"created_date": "2020-09-10 07:39:51"
},
.
.
.
.
{
"id": "5f3499650b306a33be22f7fb",
"title": "온라인 문진표 - KLPGA 신한동해오픈",
"created_date": "2020-08-13 10:37:41"
}
]
}
GET 요청 유의사항
계약서 다운로드 API를 제외한 모든 GET 요청은 즉시성을 보장하지 않으며 최대 10초 전의 상태일 수 있습니다.
Updated over 3 years ago