Senzing in 3 REST API Calls
This is a simple example of how to add and search Senzing 3.x via the REST API.
Prerequisites
- Complete the Senzing Quickstart
Run SenzingGo.py
From your /home/user/your_project
directory:
sudo --preserve-env ./python/SenzingGo.py
SenzingGo.py
outputs the URL/port information for the REST API, the SwaggerUI to interface with the REST API, and the Entity Search WebApp.
There are many options for installing Senzing and the RESTful API (docker-compose, Kubernetes, AWS Cloudformation, AKS, OpenShift, etc) that can be found on the Senzing Community GitHub, but SenzingGo.py
is the easiest deployment to try Senzing.
Python example
Note
Modify the localhost:8250
in the URL of the commands to match your REST API URL from the SenzingGo.py
output.
Entity resolve a record
curl -X 'PUT' \
'http://localhost:8250/data-sources/TEST/records/1?withInfo=false&withRaw=false' \
-H 'accept: application/json; charset=UTF-8' \
-H 'Content-Type: application/json; charset=UTF-8' \
-d '{ "NAME_FULL": "JOHN SMITH", "ADDR_FULL": "123 Main St, Las Vegas NV" }'
Get the entity it resolved to
curl -X 'GET' \
'http://localhost:8250/data-sources/TEST/records/1/entity?featureMode=WITH_DUPLICATES&withFeatureStats=false&withInternalFeatures=false&forceMinimal=false&withRelated=PARTIAL&withRaw=false' \
-H 'accept: application/json; charset=UTF-8'
Search for entities
curl -X 'POST' \
'http://localhost:8250/search-entities?featureMode=WITH_DUPLICATES&withFeatureStats=false&withInternalFeatures=false&forceMinimal=false&withRelationships=false&withRaw=false' \
-H 'accept: application/json; charset=UTF-8' \
-H 'Content-Type: application/json; charset=UTF-8' \
-d '{ "NAME_FIRST": "JANE", "NAME_LAST": "SMITH", "ADDR_FULL": "123 Main St, Las Vegas NV" }'