Documentation
¶
Overview ¶
法人番号システム Web-API 用パッケージです。
法人番号システム Web-API(https://www.houjin-bangou.nta.go.jp/webapi/) 対し リクエストを行い法人情報を取得します。
利用には次のリンクからアプリケーション ID の申請と取得が必要です。 https://www.houjin-bangou.nta.go.jp/webapi/riyo-todokede/
関連ドキュメント:
・API 仕様書「Web-API(Ver.4.0)のリクエストの設定方法及び提供データの内容について」 https://www.houjin-bangou.nta.go.jp/documents/k-web-api-kinou-ver4.pdf
・API 仕様書「Web-API(Ver.1.1)のリクエストの設定方法及び提供データの内容について」 https://www.houjin-bangou.nta.go.jp/documents/k-web-api-kinou-gaiyo.pdf
・都道府県コード: https://nlftp.mlit.go.jp/ksj/gml/codelist/PrefCd.html
・都道府県コード+市区町村コード: https://www.soumu.go.jp/denshijiti/code.html
Index ¶
- Constants
- func SetAppID(tkn string)
- func SetFetch(f func(URL string, options interface{}) (int, []byte, error))
- type Corporation
- type Date
- func (date Date) MarshalJSON() ([]byte, error)
- func (date Date) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (date Date) String() string
- func (date Date) Time() time.Time
- func (date *Date) UnmarshalJSON(b []byte) error
- func (date *Date) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Response
Examples ¶
Constants ¶
const DATE_FORMAT = "2006-01-02"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Corporation ¶
type Corporation struct {
// 一連番号
SequenceNumber uint32 `xml:"sequenceNumber"`
// 法人番号
CorporateNumber uint64 `xml:"corporateNumber"`
// 処理区分
// 01:新規, 11:商号又は名称の変更, 12:国内所在地の変更, 13: 国外所在地の変更,
// 21:登記記録の閉鎖等, 22:登記記録の復活等,
// 71:吸収合併, 72:吸収合併無効, 81:商号の登記の抹消, 99:削除
Process string `xml:"process"`
// 訂正区分
// false:訂正以外, true:訂正
Correct bool `xml:"correct"`
// 更新年月日
UpdateDate *Date `xml:"updateDate"`
// 変更年月日
ChangeDate *Date `xml:"ChangeDate"`
// 商号または名称
Name string `xml:"name"`
// 商号または名称イメージID
NameImageId string `xml:"nameImageId"`
// 法人種別
// 101:国の機関, 201:地方公共団体,
// 301:株式会社, 302:有限会社, 303:合名会社, 304:合資会社, 305:合同会社, 399:その他の設立登記法人
// 401:外国会社等, 402:その他
Kind uint16 `xml:"kind"`
// 国内所在地(都道府県)
PrefectureName string `xml:"prefectureName"`
// 国内所在地(市区町村)
CityName string `xml:"cityName"`
// 国内所在地(丁目番地等)
StreetNumber string `xml:"streetNumber"`
// 国内所在地イメージID
AddressImageId string `xml:"addressImageId"`
// 都道府県コード
// JIS X 401 に準ずる
PrefectureCode uint8 `xml:"prefectureCode"`
// 市区町村コード
// JIS X 402 に準ずる
CityCode uint16 `xml:"cityCode"`
// 郵便番号
PostCode string `xml:"postCode"`
// 国外所在地
AddressOutside string `xml:"addressOutside"`
// 国外所在地イメージID
AddressOutsideImageId string `xml:"addressOutsideImageId"`
// 登記記録の閉鎖等年月日
CloseDate *Date `xml:"closeDate"`
// 登記記録の閉鎖等の事由
// 01:精算の結了等, 11:合併による解散等, 21:登記官による閉鎖, 31:その他の精算の結了等
CloseCause string `xml:"closeCause"`
// 承継先法人番号
SuccessorCorporateNumber uint64 `xml:"successorCorporateNumber"`
// 変更事由の詳細
ChangeCause string `xml:"changeCause"`
// 法人番号指定年月日
AssignmentDate *Date `xml:"assignmentDate"`
// 最新履歴
// false: 過去情報, true:最新情報
Latest bool `xml:"latest"`
// 商号または名称(英語表記)
EnName string `xml:"enName"`
// 国内所在地(都道府県)(英語表記)
EnPrefectureName string `xml:"enPrefectureName"`
// 国内所在地(市区町村)(英語表記)
EnCityName string `xml:"enCityName"`
// 国内所在地(丁目番地等)(英語表記)
EnAddressOutside string `xml:"enAddressOutside"`
// フリガナ
Furigana string `xml:"furigana"`
// 検索対象除外
// false:検索対象, true:検索対象除外
Hihyoji bool `xml:"hihyoji"`
}
Corporation は法人番号システム Web-API から取得できるレスポンスのうち, 法人情報部分の構造体です。
func (Corporation) Available ¶
func (c Corporation) Available() bool
Available は法人情報が有効か判定します。
処理区分(Process) が 99 の場合, 一連番号(SequenceNumber), 法人番号(CorporateNumber), 更新年月日(UpdateDate) を除き すべてブランクとなります。
このデータは実際には利用できないため無効と判定されます。
func (Corporation) CloseCauseText ¶
func (c Corporation) CloseCauseText() string
CloseCauseText は CloseCause(登記事項の閉鎖等の事由)の表示用テキストを返します。
func (Corporation) KindText ¶
func (c Corporation) KindText() string
KindText は Kind(法人種別) の表示用テキストを返します。
func (Corporation) ProcessText ¶
func (c Corporation) ProcessText() string
ProcessText は Process(処理区分) の表示用テキストを返します。
type Date ¶
func (Date) MarshalJSON ¶ added in v0.1.3
func (Date) MarshalXML ¶ added in v0.1.3
func (*Date) UnmarshalJSON ¶ added in v0.1.3
func (*Date) UnmarshalXML ¶
type Response ¶
type Response struct {
// 最終更新年月日
LastUpdateDate *Date `xml:"lastUpdateDate"`
// 総件数
// 一致するデータがない場合は 0
Count uint32 `xml:"count"`
// 分割番号
DivideNumber uint32 `xml:"divideNumber"`
// 分割数
DevideSize uint32 `xml:"divideSize"`
// 法人等要素
Corporations []Corporation `xml:"corporation"`
}
Response は法人番号システム Web-API から取得できる XML データを扱います。
詳細については Web-API 仕様書巻末のリソース定義書を参照してください。
func ByNumber ¶
ByNumber は法人番号を引数に指定することで最新の法人情報を取得できます。
Example ¶
// テスト環境用の設定
// 実際に利用する際には不要
ts := testServer("./testdata/response/by_number.xml")
setTestEnvToRequest(ts)
defer ts.Close()
// 法人番号 Web-API アプリケーションIDを設定
SetAppID("your-token")
// 株式会社フィルインの法人番号
var corpNum uint64 = 5070001032626
res, _ := ByNumber(corpNum)
fmt.Println(res.Corporations[0].Name)
Output: 株式会社フィルイン
func ByNumberWithHistory ¶
ByNumberWithHistory は法人番号を引数に指定することで変更履歴を含む法人情報を取得できます。
「変更履歴」とは, 例えば本店所在地を 1 度変更している法人の場合には 変更前と変更後の 2 つの法人情報が取得できます。
func DiffSearch ¶
DiffSearch は対象期間と地域で変更があった法人情報を検索します。
from, to は YYYY-MM-DD 形式の日付文字列を指定してください。
address は空文字, 「都道府県コード」(2文字)または「都道府県コード+市区町村コード」(5文字)を 指定できます。空文字の場合, from, to に指定した期間のみで検索を行います。
各コードについては次のリンクを参照してください。
・都道府県コード: https://nlftp.mlit.go.jp/ksj/gml/codelist/PrefCd.html
・都道府県コード+市区町村コード: https://www.soumu.go.jp/denshijiti/code.html
Example ¶
// テスト環境用の設定
// 実際に利用する際には不要
ts := testServer("./testdata/response/diff_search.xml")
setTestEnvToRequest(ts)
defer ts.Close()
// 法人番号 Web-API アプリケーションIDを設定
SetAppID("your-token")
from := "2021-06-09"
to := "2021-06-09"
// 群馬県高崎市に限定
address := "10202"
res, _ := DiffSearch(from, to, address)
fmt.Println(res.Corporations[0].Name)
Output: 株式会社フィルイン
func NameSearch ¶
NameSearch は法人名と地域で法人情報を検索します。
このメソッドでは法人名を部分一致のあいまい検索で探します。
address は空文字, 「都道府県コード」(2文字)または「都道府県コード+市区町村コード」(5文字)を 指定できます。空文字の場合, address に指定した法人名のみで検索を行います。
各コードについては次のリンクを参照してください。
・都道府県コード: https://nlftp.mlit.go.jp/ksj/gml/codelist/PrefCd.html
・都道府県コード+市区町村コード: https://www.soumu.go.jp/denshijiti/code.html
Example ¶
// テスト環境用の設定
// 実際に利用する際には不要
ts := testServer("./testdata/response/name_search.xml")
setTestEnvToRequest(ts)
defer ts.Close()
// 法人番号 Web-API アプリケーションIDを設定
SetAppID("your-token")
name := "フィルイン"
// 群馬県高崎市に限定
address := "10202"
res, _ := NameSearch(name, address)
fmt.Println(res.Corporations[0].Name)
Output: 株式会社フィルイン
Directories
¶
| Path | Synopsis |
|---|---|
|
法人番号のチェックデジットパッケージです。
|
法人番号のチェックデジットパッケージです。 |
|
法人番号システム Web-API のリクエスト URL パッケージです。
|
法人番号システム Web-API のリクエスト URL パッケージです。 |