Skip to content

Latest commit

 

History

History
109 lines (78 loc) · 3.03 KB

api.md

File metadata and controls

109 lines (78 loc) · 3.03 KB

Clear My Record API

The entiity resolution system includes an API that can be used as a proxy to send records to the Senzing API. The Clear My Record API can be run as a Docker container or manually using rackup.

Starting the API

Configuration

The API uses the same configuration file as the importer and exporter. Requests to the API must include a source property that should match the name from the configuration file.

For example, if you have the following source in your configuration file, you would use "parties" as the source property in your request:

sources:
  parties:
    type: CSV
    path: /home/senzing/parties.csv
    field_map:
      party_id: RECORD_ID
      ...
Environment Variable Description Default
CMR_API_KEY API key used to authenticate with the API. This must be changed in production. ThisIsTheDefaultKey!
CMR_API_PORT Local port to bind the API to. (Docker compose only) 3000
CMR_CONFIG_FILE Path to the configuration file. config/config.yml

Running the API manually

You can use rackup to run the API locally. Make sure you've installed the latest dependencies with bundle install, and run the following command:

bundle exec rackup --port 3000

Note: If you don't specify a port, the default port for rack — 9292 — will be used.

Running the API via Docker

The bundled docker-compose.yml file includes a cmr-api profile for the API. When running docker up, simply add the --profile cmr-api flag and the API will be started alongside the other services.

Endpoints

All API endpoints will respond with an JSON object. Supported request formats include the following:

Format Content-Type
JSON (default) application/json
CSV text/csv

GET /health

A basic health endpoint that will return a 200 status code if the API is running.

Note: This endpoint does not require authentication.

Example response:

{ "status": "ok" }

POST /import

Import a single record into the Senzing API. The request must be a JSON object with the source property set, in addition to any other properties of the record.

Example JSON request:

{
  "source": "parties",
  "party_id": "12345",
  "first_name": "John",
  "last_name": "Doe",
  "dob": "1980-01-01"
}

Exampple CSV request:

"source","party_id","first_name","last_name","dob"
"parties","12345","John","Doe","1980-01-01"

Example response:

{ "status": "success"}

If the request succeeds, the API will return a 201 status code.