api wrapper for Dungeon and Fighterⓒ (dnf@korea) OpenAPI (powered by Neople OpenAPI) : support URL encoding, server name parsing, and ajax
npm install dfopenapi> api wrapper for Dungeon and Fighterⓒ (dnf@korea) OpenAPI (powered by Neople OpenAPI) : support URL encoding, server name parsing, and ajax
Using npm:
``bash`
$ npm install dfopenapi
`node.js`
var apikey =
var dfopenapi = require('dfopenapi');
var api = dfopenapi({key:apikey});
in short, you can serve apikey as string
`node.js`
var api = require('dfopenapi')(
Example:
`node.js
var apikey =
var api = require('dfopenapi')({key:apikey});
api.character.search(
{server: 'bakal', charname: 'DFCAT'},
function (res) {
console.log(res);
}
);
api.character.info.equip(
{server: 'bakal', cid: 'ccae5367270d0c2516cfb92df1d14ed3'},
function (res) {
console.log(res);
}
);
api.auction.search(
{itemname: '폭식', wordType: 'full'},
function (res) {
console.log(res)
}
);
api.item.detail(
{itemId: 'c6a38ab8c7540cfc51ea2b0b8b610fa7', wordType: 'full'},
function (res) {
console.log(res)
}
);
`
Support all apis powered by Neople OpenAPI
* Character Search
``
character.search({server:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|server|string|server unique name
or
user defined server name|Y|||
|cname|string|character name
URL encoding
or
not|Y|||
|limit|integer|# rows of response||10|100|
|wordType|string|match / start / full||match||
> [{characterId, characterName, level, jobId, jobGrowId, jobName, jobGrowName}, ...]
* Character Timeline
``
character.timeline({server:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|server|string|server unique name
or
user defined server name|Y|||
|cid|string|character unique code
(128bit hash)|Y|||
|limit|integer|# rows of response||10|100|
|code|string|timeline class code||||
> base info + {timeline: {nextUrl, rows: [{code, name, date, data}, ...]}}
* Character Base Info
``
character.info.base({server:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|server|string|server unique name
or
user defined server name|Y|||
|cid|string|character unique code
(128bit hash)|Y|||
> {characterId, characterName, level, jobId, jobGrowId, jobName, jobGrowName, adventureName, guildId, guildName}
* Character Status Info
``
character.info.status({server:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|server|string|server unique name
or
user defined server name|Y|||
|cid|string|character unique code
(128bit hash)|Y|||
> base info + {buff:[모험단버프, 무제한 길드능력치, 기간제 길드능력치], status:HP, MP, 힘, 지능,체력, 정신력, 물리 공격, 마법 공격, 독립 공격, 물리 방어, 마법 방어, 물리 크리티컬, 마법 크리티컬, 공격 속도, 캐스팅 속도, 이동 속도, 항마, 적중률, 회피율, HP 회복량, MP 회복량, 경직도, 히트리커버리, 화속성 강화, 화속성 저항, 수속성 강화, 수속성 저항, 명속성 강화, 명속성 저항, 암속성 강화, 암속성 저항 }
* Character Equipment Info
``
character.info.equip({server:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|server|string|server unique name
or
[user defined server name|Y|||
|cid|string|character unique code
(128bit hash)|Y|||
> base info + {equipment:[WEAPON, TITLE, JACKET, SHOULDER, PANTS, SHOES, WAIST, AMULET, WRIST, RING, SUPPORT, MAGIC_STON, EARRING]}
* Character Avatar Info
``
character.info.avatar({server:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|server|string|server unique name
or
user defined server name|Y|||
|cid|string|character unique code
(128bit hash)|Y|||
> base info + {avatar(array of each avatar)}
* Character Creature Info
``
character.info.creature({server:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|server|string|server unique name
or
user defined server name|Y|||
|cid|string|character unique code
(128bit hash)|Y|||
* Character Flag Info
``
character.info.flag({server:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|server|string|server unique name
or
user defined server name|Y|||
|cid|string|character unique code
(128bit hash)|Y|||
* Auction Search
``
auction.search({itemId:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|itemId|string||Y|||
|itemName|string|item name
URL encoding
or
not|Y|||
|minLevel|integer|minimum required level||||
|maxLevel|integer|maximum required level||||
|rarity|string|item rarity||||
|minReinforce|integer|minimum reinforce level||||
|maxReinforce|integer|maximum reinforce level||||
|minRefine|integer|minimum refine level||||
|maxRefine|integer|maximum refine level||||
|unitPrice|string|sort by item unit price
asc / desc||||
|reinforce|string|sort by reinforce level
asc / desc||||
|auctionNo|string|sort by auctionNo
asc / desc||||
|limit|integer|# rows of response||10|100|
|wordType|string|match / start / full||match||
itemId or itemName is required.
auctionNo: 'asc' is default unless any sort option is defined.
* Auction Detail
``
auction.detail({auctionNo:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|auctionNo|string||Y|||
* Item Search
``
item.search({itemName:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|itemName|string|item name
URL encoding
or
not|Y|||
|minLevel|integer|minimum required level||||
|maxLevel|integer|maximum required level||||
|rarity|string|item rarity||||
|trade|boolean|can regist auction||false||
|limit|integer|# rows of response||10|100|
|wordType|string|match / start / full||match||
* Item Detail
``
item.detail({itemId:
|parameter|type|description|required|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|itemId|string||Y|||
> array of {characterId, characterName, level, jobId, jobGrowId, jobName, jobGrowName}
> !! Legacy API is not recommanded. We have no responsiblilty for abusing this legacy api.
In officail homepage of dungeon and fighter, there is legacy api via http://df.nexon.com/FRM/info/charac_search_api.php for character search and view detail. It is for pure web browser, not for 3-party app like pris.kr.
Legacy api is not need apikey. So, it cannot be controlled by neople and can cause big traffic on neople server, and might access blocked from neople.
Legacy api is not separated by category (equip/avatar/...). Its response contains full information and it has redundant. Legacy api is not supported by Neople API, it is not up-to-date. For example, Neople API update to contain {adventureName, guildId, guildName} in base info in 20180104, however, legacy api is not contains adventrueName which is important for identifing unique user (or account).
Legacy api handles no (charac_no in response) for characterId. But it is different from Neople API's. You must be careful of mix legacy API with Neople API.
Legacy api contains avatar_image and occDate, not supported in Neople API.
DNF Web Avatar renderer(http://avatar.df.nexon.com/) uses charac_no in legacy API, not characterId in Neople API. So, if you want to contain avatar image on your service, you should use legacy API until Neople support avatar image url in Neople API. (Or merge no and characterId).
occDate in stat shows the time recent logout.
* Common API for Search / Detail
``
character.legacy.axios({mode:
|parameter|type|description|necessary|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|mode|string|search / detail|Y|||
|no|string|character unique code
(128bit hash)
Differ from Neople API|Y|||
|server|string|server unique name
or
user defined server name|Y|||
* Character Detail
``
character.legacy.character.info({no:
|parameter|type|description|necessary|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|no|string|character unique code
(128bit hash)
Differ from Neople API|Y|||
|server|string|server unique name
or
user defined server name|Y|||
* Common API for Community
``
character.legacy.request({url:
|parameter|type|description|necessary|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|url|string||Y|||
* Capture Board
```
character.legacy.community.api({type:
|parameter|type|description|necessary|default|maximum|
|:-:|:-:|:-:|:--:|:-:|:-:|
|type|string|charac_name / title|Y|||
|keyword|string|character name / title
URL encoding
or
not|Y|||
For euc-kr decoding, use request insted of axios.
dfopenapi contains server name parsing through parseServer.
Unique server name is like 'bakal', 'cain', however, you can use user defined server name like '바칼'. Even if you can use just 'B' for server name.
Wanna more, add additional set into parser in lib/parseServer.js like "dire": "diregie".
dfopenapi contains URL Encoding process esc for username/itemname.
It use regular expression to check name is URL encoded. If it already already encoded, return string directly. Else, use querystring.escape to URL encoding.
So, you don't care about name is URL encoded or not.
Include {adventureName, guildId, guildName} and trade property in item.search in 20180104 patch.
Include community capture crawler in official homepage legacy.community.capture
Divide single dfopenapi.js into each modules (api.js, auction.js, character.js, escape.js, item.js, legacy.js, parseServer.js)
Include character.timeline in 20180111 patch.