NAV Navbar
Python Java C G2Command shell
  • Quickstart
  • Quickstart

    To dive in and start tinkering with Senzing ER and the APIs it is suggested you first become familiar with the Quickstart Roadmap. The Introduction Quickstart guide details deploying Senzing ER and loading the supplied sample data - which will be used throughout this API reference.

    If you already have Senzing ER deployed and need to reload the sample data to work with, it can be loaded in one of 2 ways:

    $ cd /opt/senzing/g2/python $ . ../setupEnv $ python G2Loader.py -P
    $ cd /opt/senzing/g2/python $ . ../setupEnv $ python G2Loader.py -P -p demo/sample/project.csv

    G2Command shell

    G2Command shell is an interactive shell useful for testing and becoming familiar with the Senzing ER APIs (note: currently only python-specific versions are shown). Similarly to loading data into Senzing ER, G2Command shell is started from the terminal. It will take a few seconds for a Senzing ER instance to be initialized:

    $ cd /opt/senzing/g2/python $ . ../setupEnv $ python G2Command.py Initializing engine... Welcome to the G2 shell. Type help or ? to list commands. (g2)

    G2Command shell has built in help:

    (g2) help Documented commands (type help ): ======================================== addRecord getActiveConfigID process anonymize getAuditReport processFile anonymizeFile getEntityByEntityID processFileWithResponse closeExport getEntityByRecordID processWithResponse closeSession getRecord purgeRepository deleteRecord getRepositoryLastModifiedTime quit exit getSummaryData replaceRecord exportCSVEntityReport getUsedMatchKeys searchByAttributes exportConfig getUsedPrinciples stats exportJSONEntityReport help version exportTokenLibrary license fetchNext openSession Miscellaneous help topics: ========================== KnowledgeCenter MatchLevels Support Shell Arguments (g2)

    Retrieve help on a specific API, issue help followed by the API name:

    (g2) help getEntityByRecordID Get entity by record ID: getEntityByRecordID <dataSourceCode> <recordID> (g2)

    Call an API:

    (g2) getEntityByRecordID COMPANIES 2003
    {"RESOLVED_ENTITY":{"ENTITY_ID":1003,"LENS_ID":1,"FEATURES":{"ADDRESS":[{"FEAT_DESC":"2003 SOUTHERN HIGHLANDS, PKWY LAS VEGAS NV 89333","UTYPE_CODE":"PRIMARY"},{"FEAT_DESC":"2004 HORIZON RIDGE LAS VEGAS NV 89444","UTYPE_CODE":"PRIMARY"}],"NAME":[{"FEAT_DESC":"FABRICS UNLIMITED INC","UTYPE_CODE":"PRIMARY"}],"OTHER_ID":[{"FEAT_DESC":"33333 D&B"}],"PHONE":[{"FEAT_DESC":"800-301-3001","UTYPE_CODE":"PRIMARY"}],"TAX_ID":[{"FEAT_DESC":"EIN33333 US"}],"WEBSITE_ADDR":[{"FEAT_DESC":"FABRICS-UNLIMITED.COM"}]},"RECORD":[{"DATA_SOURCE":"COMPANIES","DSRC_ACTION":"A","ENTITY_TYPE":"COMPANIES","LOAD_ID":"sample_company.csv","MAIL_ADDR_CITY":"","MAIL_ADDR_COUNTRY":"","MAIL_ADDR_LINE1":"","MAIL_ADDR_LINE2":"","MAIL_ADDR_LINE3":"","MAIL_ADDR_POSTAL_CODE":"","MAIL_ADDR_STATE":"","OTHER_ID_COUNTRY":"","OTHER_ID_NUMBER":"33333","OTHER_ID_TYPE":"D&B","PRIMARY_ADDR_CITY":"Las Vegas","PRIMARY_ADDR_COUNTRY":"US","PRIMARY_ADDR_LINE1":"2003 Southern Highlands, Pkwy","PRIMARY_ADDR_LINE2":"","PRIMARY_ADDR_LINE3":"","PRIMARY_ADDR_POSTAL_CODE":"89333","PRIMARY_ADDR_STATE":"NV","PRIMARY_NAME_ORG":"Fabrics Unlimited, Inc","PRIMARY_PHONE_NUMBER":"800-301-3001","RECORD_ID":"2003","SOCIAL_HANDLE":"","SOCIAL_NETWORK":"","TAX_ID_COUNTRY":"US","TAX_ID_NUMBER":"EIN33333","WEBSITE_ADDRESS":"fabrics-unlimited.com","ENTITY_KEY":"359E1A5A7ABA60313D5E125AF97E0C35C85AE1C0","ENTITY_NAME":"Fabrics Unlimited, Inc","MATCH_KEY":"","MATCH_SCORE":"","ERRULE_CODE":"","REF_SCORE":0,"MATCH_LEVEL":0},{"DATA_SOURCE":"COMPANIES","DSRC_ACTION":"A","ENTITY_TYPE":"COMPANIES","LOAD_ID":"sample_company.csv","MAIL_ADDR_CITY":"","MAIL_ADDR_COUNTRY":"","MAIL_ADDR_LINE1":"","MAIL_ADDR_LINE2":"","MAIL_ADDR_LINE3":"","MAIL_ADDR_POSTAL_CODE":"","MAIL_ADDR_STATE":"","OTHER_ID_COUNTRY":"","OTHER_ID_NUMBER":"","OTHER_ID_TYPE":"","PRIMARY_ADDR_CITY":"Las Vegas","PRIMARY_ADDR_COUNTRY":"","PRIMARY_ADDR_LINE1":"2004 Horizon Ridge","PRIMARY_ADDR_LINE2":"","PRIMARY_ADDR_LINE3":"","PRIMARY_ADDR_POSTAL_CODE":"89444","PRIMARY_ADDR_STATE":"NV","PRIMARY_NAME_ORG":"Fabrics Unlimited","PRIMARY_PHONE_NUMBER":"800-301-3001","RECORD_ID":"2004","SOCIAL_HANDLE":"","SOCIAL_NETWORK":"","TAX_ID_COUNTRY":"","TAX_ID_NUMBER":"","WEBSITE_ADDRESS":"fabrics-unlimited.com","ENTITY_KEY":"21474689FCEB855F6F2D3EBE212E98882B6E06D2","ENTITY_NAME":"Fabrics Unlimited","MATCH_KEY":"+NAME+PHONE+WEBSITE_ADDR","MATCH_SCORE":"14","ERRULE_CODE":"MFF_CNAME","REF_SCORE":8,"MATCH_LEVEL":1}]},"RELATED_ENTITY":[]}
    (g2)

    Quick link to the Senzing knowledge center (ctrl click the link):

    (g2) help KnowledgeCenter
    Senzing Knowledge Center: https://senzing.zendesk.com/hc/en-us
    (g2)

    Quick link to the Senzing support (ctrl click the link):

    (g2) help Support
    Senzing Support Request: https://senzing.zendesk.com/hc/en-us/requests/new
    (g2)

    Run basic OS shell commands from within G2Command shell.

    (g2) help Shell Run OS shell commands: ! (g2) ! ls -l /opt/senzing/g2/python/demo/sample total 24 -rw-rw-r-- 1 user user 96 Sep 1 17:40 project.csv -rw-rw-r-- 1 user user 178 Sep 1 17:40 project.json -rw-rw-r-- 1 user user 957 Sep 1 17:40 sample_company.csv -rw-rw-r-- 1 user user 1847 Sep 1 17:40 sample_company.json -rw-rw-r-- 1 user user 1100 Sep 1 17:40 sample_person.csv -rw-rw-r-- 1 user user 2211 Sep 1 17:40 sample_person.json (g2)

    G2Command shell supports history and shell shortcuts. For example, if your shell is bash up and down arrow scrolls through history, CTRL-R will reverse search, CTRL-L to clear screen, etc

    History is only maintained for the current G2Command shell session, it is not preserved after exiting G2Command shell.