node-jp

Client of the statics data provided by the goverment of Japan.

node.jp

Client library of the statics data provided by the goverment of Japan.

How to install

npm install nodeJP

How to use

You can use client's 3 APIs.

  • list: Get statistics table list
  • meta: Get statistics table meta information
  • search: Get statictics table data

Before use these API, you need appId for configure client from this page. With this appId, you make client like below.

var nodeJP = require('nodeJP');

var config = {
    appId : <Your application id from beyond site>
};  

var client = new nodeJP(config);

And then you can get various data with this client.

Get statistics table list. All API need callback function made by you. For example,

function yourCallback(data) {
    // Write your code
    // data is different respective API 
}

client.list(params, yourCallback);

Parameters which should be set are written in this manual

Parameter keyA useExample
langResponse default languageE or J
surveyYearsWhen target data is surveyed. Format is yyyy or yyyymm or yyyymm-yyyymm2013
openYearsWhen target data is opened. Format is yyyy or yyyymm or yyyymm-yyyymm2013
statsFieldThe field of target statistics data. 2-digit or 4-digit number which is based on category of statistics of Japan02
statsCodeGoverment statistics code. 5-digit or 8-digit number12345
searchWordYour search keyword. Any stringTokyo
searchKindKind of target data1: statistics data(default), 2: regional mesh, 3: social or population
statsNameListStatistics survey nameY

Response object is StatsList object. This object is composed of below members.

MemberA useType
resultResponse code and Error messageObject
parameterYour request parametersObject
numberNumber of response listString
listStatistics table listArray

Get meta information of statistics table. This API needs also your callback.

In this API, you need to give only statsDataId. This ID is obtained from above list API.

Parameter keyA useExample
statsDataIdStatistics table id0003003333

Response object is MetaInfo object. This object is composed of below members.

MemberA useType
resultResponse code and Error messageObject
parameterYour request parametersObject
tableInfStatistics table meta informationObject
classInfFactors of which statistics table is composedObject

Get statistics data. This API needs also your callback.

Parameter keyA useExample
statsDataIdStatistics table id0003003333
lvTabTable tag level. Format is X or X-X or -X or X-1-9
cdTabItem code01000
cdTabFromStart item code of range search01000
cdTabToEnd item code of range search02000
lvTimeTime level. Format is the same as category level1-9
cdTimeItem code about time01000
cdTimeFromStart item code of range search01000
cdTimeToEnd item code of range search02000
lvAreaArea level. Format is the same as category level1-9
cdAreaItem code about area01000
cdAreaFromStart item code of range search01000
cdAreaToEnd item code of range search02000
lvCat0[1-15]Category level. Format is the same as category level1-9
cdCat0[1-15]Item code about category01000
cdCat0[1-15]FromStart item code of range search01000
cdCat0[1-15]ToEnd item code of range search02000
・・・・・・・・・
startPositionStart offset of data list1
limitMax number of data list15
metaGetFlgWhether meta info is added or notY or N
cntGetFlgOnly count of data listY or N

Client returns your callback StatsData object.

MemberA useType
resultResponse code and Error messageObject
parameterYour request parametersObject
tableInfStatistics table meta informationObject
classInfData of which statistics table is composedObject

Gateway to Advanced and User-friendly statics service