Overview
This is a simple example of how to add and search Senzing via the open source RESTful API. This requires that the Senzing REST API Server is set up and running.
The easiest way to do this is to have completed the Senzing Quickstart and then launch the REST API server with SenzingGo which should take less than 15minutes:
# Run the Senzing Quickstart and then from the same shell, still in the project directory, run: $ sudo --preserve-env ./python/SenzingGo.py
# Senzing go will output the URL/port that the RESTful API is listening on
For more on the Senzing RESTful API go here.
For more on SenzingGo go here.
There are many other options for installing Senzing and the example open source RESTful API (docker-compose, Kubernetes, AWS Cloudformation, AKS, OpenShift, etc) that can be found on the Senzing Community GitHub but SenzingGo is the most simple deployment for someone just trying Senzing out.
Example
Note: Adjust the URL on the commands to match your RESTful API installation.
Note: These REST calls themselves have not changed since 2.x
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" }'
Comments
0 comments
Please sign in to leave a comment.