REST APIs

Plain HTTP and JSON. Or a typed client in your language.

Optimaize provides REST APIs in JSON. Either use one of our official client libraries, or call the endpoints directly over HTTP — whatever fits your stack.

The OpenAPI specification is available as Swagger UI — discover endpoints, understand functionality and test requests directly from your browser.

Setup

Creating a context

The context parameter passes execution-environment information so the application can understand the request and control server behavior.

{
  "context": {
    "priority": "REALTIME",
    "properties": []
  }
}
Setup

Creating a service

CommandExecutor executor = CommandExecutors.createExecutor();
Mode mode = NameApiModeFactory.minimal("your-api-key")
    .with(StdoutLoggingExtension.enabled());

// Customising host and version:
Mode mode = NameApiModeFactory.withContext(
    "your-api-key",
    myContext,
    new Host("api.example.com", Protocol.HTTPS),
    NameApiPortUrlFactory.version5_3()
);
Service

Ping

Health-check the service.

PingCommand command = new PingCommand();
String pong = executor.execute(command, mode, null).get();
Service

Name Parser

See the Name Parser page.

PersonNameParserCommand command = new PersonNameParserCommand();
InputPersonName name = NameBuilders.western()
    .fullname("John F. Kennedy").build();
InputPerson inputPerson = new NaturalInputPersonBuilder()
    .name(name).build();
PersonNameParserResult result = executor.execute(command, mode, inputPerson)
    .get();
Service

Genderizer

See the Genderizer page.

PersonGenderizerCommand command = new PersonGenderizerCommand();
NaturalInputPerson person = new NaturalInputPersonBuilder()
    .name(NameBuilders.western().fullname("John Doe").build())
    .build();
GenderizerResult result = executor.execute(command, mode, person)
    .get();
boolean isMale = result.getGender().isMale();
Service

Person Matcher

See the Name Matcher page.

PersonMatcherCommand command = new PersonMatcherCommand();
NaturalInputPerson person1 = new NaturalInputPersonBuilder()
    .name(NameBuilders.western().fullname("John F. Kennedy").build())
    .build();
NaturalInputPerson person2 = new NaturalInputPersonBuilder()
    .name(NameBuilders.western().fullname("Jack Kennedy").build())
    .build();
PersonMatcherArgument argument = new PersonMatcherArgument(person1, person2);
PersonMatcherResult result = executor.execute(command, mode, argument)
    .get();
Service

Disposable Email Detector

See Disposable Email Detector.

DisposableEmailAddressDetectorCommand command =
    new DisposableEmailAddressDetectorCommand();
DisposableEmailAddressDetectorResult result =
    executor.execute(command, mode, "blahblah@10minutemail.com").get();
Next steps

Start integrating

Pull a client library from the Libraries page, or open the Swagger UI and start firing requests.