Skip to content

abdulkareem-reachstream/Predefined-values

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

RSApiClient

Overview

RSApiClient is a Java class designed to interact with a remote API. It includes methods to retrieve various predefined records from the API based on different query parameters, such as job titles, SIC codes, company names, etc. The class utilizes Apache HttpClient to send HTTP requests and handle responses.

Features

  • Makes HTTP GET requests to the API.
  • Supports multiple query parameters such as job titles, SIC codes, company names, and more.
  • Handles response status and returns the response body or throws an exception if the request fails.

Class Usage

1. Import the RSApiClient Class

First, you need to import the RSApiClient class into your Java project. Make sure you have the JAR file (RSApiClient.jar) or the source code in your classpath.

Example import statement:

import org.rs.RSApiClient;

2. Create an Instance of RSApiClient

To use the RSApiClient, you need to instantiate it by passing your API key to the constructor.

RSApiClient client = new RSApiClient("your-api-key-here");

Replace "your-api-key-here" with your actual API key.

3. Call Methods to Retrieve Data

The RSApiClient class provides several methods to fetch predefined records. Below is an example of how to use the getJobTitle method.

Example: Get Job Title List

import org.rs.RSApiClient;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        try {
            // Instantiate RSApiClient with your API key
            RSApiClient client = new RSApiClient("your-api-key-here");

            // Call the method to get job titles based on a query value
            String jobTitles = client.getJobTitle("developer");

            // Print the retrieved job titles
            System.out.println("Job Titles: " + jobTitles);
        } catch (IOException e) {
            System.err.println("Error retrieving data: " + e.getMessage());
        }
    }
}

This example calls the getJobTitle method with the value "developer", retrieves the response, and prints it out.

4. Available Methods in RSApiClient

Here are the available methods in RSApiClient:

  • getJobTitle(String value): Retrieves job titles based on the query parameter job_title.
  • getSicCode(String value): Retrieves SIC codes based on the query parameter sic_code.
  • getAddressZipCode(String value): Retrieves address zip codes based on the query parameter address_zipcode.
  • getAddressCity(String value): Retrieves address cities based on the query parameter address_city.
  • getAddressState(String value): Retrieves address states based on the query parameter address_state.
  • getAddressCountry(String value): Retrieves address countries based on the query parameter address_country.
  • getCompanyNames(String value): Retrieves company names based on the query parameter company_name.
  • getWebsites(String value): Retrieves websites based on the query parameter website.
  • getTechKeywords(String value): Retrieves technology keywords based on the query parameter tech_keywords.
  • getJobTitleLevel(String value): Retrieves job title levels based on the query parameter job_title_level.
  • getJobDepartmentNames(String value): Retrieves job department names based on the query parameter job_dept_name.
  • getJobFunctionNames(String value): Retrieves job function names based on the query parameter job_function_name.
  • getCompanyType(String value): Retrieves company types based on the query parameter company_type.
  • getCompanyIndustryCategoryList(String value): Retrieves company industry categories based on the query parameter company_industry_categories_list.
  • getEmployeeSize(String value): Retrieves employee size based on the query parameter employee_size.
  • getAnnualRevenueAmount(String value): Retrieves annual revenue amounts based on the query parameter annual_revenue_amount.

Each of these methods returns a String containing the response data in JSON format.

Example of Calling Different Methods

Here’s how to use some of the other methods:

import org.rs.RSApiClient;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        try {
            // Instantiate RSApiClient with your API key
            RSApiClient client = new RSApiClient("your-api-key-here");

            // Get a job title list
            String jobTitles = client.getJobTitle("developer");
            System.out.println("Job Titles: " + jobTitles);

            // Get a SIC code list
            String sicCodes = client.getSicCode("111");
            System.out.println("SIC Codes: " + sicCodes);

            // Get a company names list
            String companyNames = client.getCompanyNames("Tech");
            System.out.println("Company Names: " + companyNames);

        } catch (IOException e) {
            System.err.println("Error retrieving data: " + e.getMessage());
        }
    }
}

Error Handling

The methods in RSApiClient throw an IOException if there is a failure in making the request or processing the response. Be sure to handle these exceptions appropriately in your code.

Troubleshooting

  • Invalid API Key: If you encounter issues with authentication, double-check your API key.
  • API Not Responding: Ensure the API URL is correct and the service is operational.
  • Invalid Query Parameter: If the API returns an empty or error response, verify that the query parameter is valid.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors