Corporate Number API Company Information Acquisition

Stores the "company name", "postal code", "domestic address" of the Corporate Number system respectively into the data item, and stores its communication log in a String type data item

    A. Set Application Id (Access Key) for Houjin Web-APISingle-line inputRequired
    B. Select STRING/SELECT for a Corporate NumberData selectString(single line)orSelect(radio/select/search)Required
    C. Select STRING DATA for Corporate Name (update)Data selectString(single line)Required
    D. Select STRING DATA for Corporate PostCode (update)Data selectString(single line)
    E. Select STRING DATA for Corporate Address (update)Data selectString(single line)
    X. Select STRING DATA for Access Log (update)Data selectString(multiple line)
    -variable namevariable label
    Aconf_AppIdSet Application Id (Access Key) for Houjin Web-API
    Bconf_DataIdBSelect STRING/SELECT for a Corporate Number
    Cconf_DataIdCSelect STRING DATA for Corporate Name (update)
    Dconf_DataIdDSelect STRING DATA for Corporate PostCode (update)
    Econf_DataIdESelect STRING DATA for Corporate Address (update)
    Xconf_DataIdXSelect STRING DATA for Access Log (update)
    // Get Info via Corporate Number API v1 (ver. 20161102)
    // (c) 2016, Questetra, Inc. (the MIT License)
    
    //// == 工程コンフィグの参照 / Config Retrieving ==
    var appId   = configs.get( "conf_AppId" );
    var dataIdB = configs.get( "conf_DataIdB" ); // (returns Number)
    var dataIdC = configs.get( "conf_DataIdC" ); // (returns Number)
    var dataIdD = configs.get( "conf_DataIdD" ) + "";
    var dataIdE = configs.get( "conf_DataIdE" ) + "";
    var dataIdX = configs.get( "conf_DataIdX" ) + "";
    
    //// == ワークフローデータの参照 / Data Retrieving ==
    var corporateNumber = "";
    if( data.get( dataIdB ) instanceof java.util.ArrayList ){
      corporateNumber = data.get( dataIdB ).get(0).getValue() + "";
    }else if( data.get( dataIdB ) instanceof java.lang.String ){
      corporateNumber = data.get( dataIdB ) + "";
    }
    
    //// == 演算 / Calculating ==
    var accessLog = "";
    var uri = "https://api.houjin-bangou.nta.go.jp/1/num";
    var response = httpClient.begin()
      .queryParam( "id", appId )
      .queryParam( "number", corporateNumber )
      .queryParam( "type", 12 ) // Response Format: XML
      .queryParam( "history", 0 )
      .get( uri ); 
    accessLog += "---GET request--- " + response.getStatusCode() + "\n";
    accessLog += response.getResponseAsString() + "";
    
    var responseXml = response.getResponseAsString() + "";
    responseXml = responseXml.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); 
    // E4X (ECMAScript for XML) bug 336551
    var xmlObj = new XML( responseXml );
    var responseName = xmlObj.corporation[0].name + "";
    var responsePostCode = xmlObj.corporation[0].postCode + "";
    var responseAddress = xmlObj.corporation[0].prefectureName + "";
    responseAddress += xmlObj.corporation[0].cityName + "";
    responseAddress += xmlObj.corporation[0].streetNumber + "";
    
    //// == ワークフローデータへの代入 / Data Updating ==
    retVal.put( dataIdC, responseName );
    if( dataIdD !== "" ){
      retVal.put( dataIdD, responsePostCode );
    }
    if( dataIdE !== "" ){
      retVal.put( dataIdE, responseAddress );
    }
    if( dataIdX !== "" ){
      retVal.put( dataIdX, accessLog );
    }
    

    • B’: Corporate Number stored in the Data Item that is selected at B
    • “Company name or Trade name”, “Zip code”, “Domestic address” in the Corporate Number system will be respectively stored in the Data Items that are selected at C, D, and E.
    • The communication logs are stored in the data item selected in X
    • It requires completion of “Procedure of Application ID issuance” at Corporate Number system Official Web site (which is written in Japanese only) in advance
    • Error detection calculation by Check Digit for the 13 digits of Corporate Number will not be performed