Overview - Search

Introduction

The Search API (Lens API) provides capabilities for searching and matching resumes and jobs based on specified search criteria. It also enables you to create, delete, retrieve, search, and fetch resumes and jobs stored in the search data repository.

Get API Access Credentials

The Search API requires security credentials to access protected resources. After signing in, you can find your credentials under Profile > OAuth Settings.

You need the following four credentials to access protected resources in the Search API:

  • Consumer Key
  • Consumer Secret
  • Search API Access Token
  • Search API Access Token Secret

Generate Authorization Header

Download the OAuthGeneration library and add it to your application.

Use the OAuthGeneration library to generate the authorization header, as shown in the following examples.

OAuthGeneration oAuth = new OAuthGeneration("WEB_SERVICE_URL", "HTTP_METHOD", "CLIENT_ID", "CLIENT_SECRET", "API_ACCESS_TOKEN", "API_ACCESS_TOKEN_SECRET");

String oAuthString = oAuth.GetOAuthString();
string oAuthString = OAuthGeneration.OAuth.GetOAuthString("WEB_SERVICE_URL", "HTTP_METHOD", "CLIENT_ID", "CLIENT_SECRET", "API_ACCESS_TOKEN", "API_ACCESS_TOKEN_SECRET");
$oAuth = new OAuthGeneration("WEB_SERVICE_URL", "HTTP_METHOD", "CLIENT_ID", "CLIENT_SECRET", "API_ACCESS_TOKEN", "API_ACCESS_TOKEN_SECRET");

$oAuthString = $oAuth->GetOAuthString();
oAuth = OAuthGeneration("WEB_SERVICE_URL", "HTTP_METHOD", "CLIENT_ID", "CLIENT_SECRET", "API_ACCESS_TOKEN", "API_ACCESS_TOKEN_SECRET")

oAuthString = oAuth.GetOAuthString()

Authentication


API Authentication Using OAuth 1.0

Every API call is authenticated using the OAuth 1.0 standard. Each HTTP request must include an OAuth authorization header using the authentication information provided by Lightcast.

The OAuth Consumer Key (oauth_consumer_key) maps to a client, while the OAuth Token (oauth_token) maps to the API being accessed.

Requests are scoped to the client identified by the OAuth Consumer Key. For example, a GETrequest to a URI returns results associated with the client specified by the OAuth Consumer Key.

Lightcast supports the following OAuth signature methods:

  • HMAC-SHA1
  • RSA-SHA1

The PLAINTEXT signature method is not supported.

Configure Request and Response

To use the Search API, prepare the request data in the format required by the endpoint.

The API accepts both XML and JSON request data.

Use the Content-Type header in the HTTP request to specify the format of the request data. Use the Accept header to specify the format of the response.

The API can return either XML or JSON formatted responses based on the Accept header.

Use the following media types:

  • application/xml for XML
  • application/json for JSON

Request Parameters

Send an HTTP request to the appropriate Search endpoint with the following information:

  • Authorization header
  • Content-Type and Accept headers
  • Endpoint URL
  • Request data

Download the LensApiClient library and add it to your application.

You can use the LensApiClient library to send requests to the API as follows:

LensApiClient apiClient = new LensApiClient();

String response = apiClient.sendLensApiRequest("WEB_SERVICE_URL", "HTTP_METHOD", oAuthString, "ContentType", "AcceptType", "REQUEST_BODY");

Response Parameters

NameDescription
RequestIdUnique ID for each request. You can use this ID to query the API logs.
TimestampTimestamp indicating when the request was made. For example, 2020-12-12 22:36:45.220.
StatusIndicates whether the request succeeded or failed.
StatusCodeHTTP response status code. Refer to the Best Practices page for more details about the possible status codes.
ResponseDataAn object containing the search API response. For successful requests, it contains the search response data. For failed requests, it contains an error message. Refer to the endpoint documentation for details about the response object structure.

Status Code Summary

CodeMeaningDescription
200OKRequest was successful.
400Bad RequestThe request was unacceptable, often due to missing a required parameter.
401UnauthorizedAuthentication error.
404Not FoundResource not found.

Next Steps

Download the sample code from here.

Before running the sample, make sure the following values are configured:

NameDescription
WEB_SERVICE_URLREST/SOAP URL
HTTP_METHODHTTP method
CLIENT_IDConsumer Key
CLIENT_SECRETConsumer Secret
API_ACCESS_TOKENSearch API access token(Based on the api which you are going to use)
API_ACCESS_TOKEN_SECRETSearch API access token secret.
CONTENT_TYPEapplication/xml or application/json
ACCEPT_TYPEapplication/xml or application/json
REQUEST_BODYXML/JSON formatted data to be posted to the API
🔗

For a complete list of HTTP status codes and their meanings, refer here.