Skip to content

getuser

ale23yfm edited this page Mar 5, 2025 · 6 revisions

/getuser/ endpoint in QA

/getuser/ endpoint in SWAGGER-UI

curl -X 'GET' \ 'http://localhost:8080/api/v0/getuser/?ID=<your ID>' \ -H 'accept: application/json'



Technical Documentation

Request and Response Structure

  • Method: GET
  • Endpoint name: /getuser
  • Request Parameters:
    • ID (required) – The unique identifier for the user (email address encoded as a URL parameter).
  • Response Format: application/json; charset=utf-8

Expected Data Format

{
    "id": "<string>",
    "url": ["<string>"],
    "company": ["<string>"],
    "logo": ["<string>"],
    "apikey": ["<string>"]
}
  • id: The unique identifier for the user (email address).
  • url: The company's careers page URL.
  • company: The company associated with the user.
  • logo: The logo URL of the company.
  • apikey: The API key assigned to the user.

List of Status Codes and Error Messages

  • 200 OK – Request successful, returns list of companies and job counts if applicable.
  • 400 Bad Request – Invalid request parameters or missing required fields.
  • 401 Unauthorized – Authentication is required or invalid credentials.
  • 403 Forbidden – Access denied due to insufficient permissions.
  • 404 Not Found – The requested endpoint or resource does not exist.
  • 405 Method Not Allowed – Only GET requests are supported.
  • 500 Internal Server Error – An unexpected error occurred on the server.
  • 502 Bad Gateway – The primary and fallback servers are both unreachable.
  • 503 Service Unavailable – The SOLR server is down or unreachable.
  • 507 Insufficient Storage – SOLR or API server runs out of space/memory.
{
    "error": "<message>",
    "code": "<number>"
}

Specific Conditions or Filters Applied

  • Fetches user data from the SOLR search index (auth core).
  • If the requested ID is not found, a 404 Not Found response is returned.
  • If SOLR is unavailable, a 503 Service Unavailable error is returned.

Database Schema Used

  • Queries SOLR search index (auth core) for user data.
  • Uses id as the key to retrieve user details.

Business Logic Applied

  • Queries user details using q=id:<user_email>.
  • If no user is found, returns a 404 Not Found error.
  • If SOLR is unavailable, a 503 Service Unavailable error is returned.

Security Measures

  • CORS policy: Open to all (Access-Control-Allow-Origin: *).
  • Authentication & Authorization: Not implemented in current version.
  • Rate Limits: Not specified but should be considered for production.

Dependencies

  • SOLR Search Server – Required to fetch user data.
  • PHP file_get_contents function – Fetches SOLR API response.

Known Limitations & Edge Cases

  • SOLR Downtime: If SOLR is unavailable, API returns a 503 error.
  • Empty Dataset: If no user exists with the given ID, the API returns "There are no users to display".
  • Invalid ID Format: If ID is not provided or is improperly formatted, a 400 Bad Request error is returned.
  • Security Risks: API keys are returned in the response, which may pose security concerns.
  • Non-empty string: All fields must be non-empty.
  • Unique Values: Api keys are uniquely determined.
  • To do: Implement authentication for accessing user data.
  • To do: Secure SOLR with security.json.
  • To do: Protect SOLR by IP whitelist.


Business Requirement Document: Retrieve User Information Endpoint

Objective:

The objective of this project is to develop an API endpoint that retrieves user information from a SOLR index. This endpoint will be used to fetch specific user details based on a unique identifier.

Key Requirements:

  1. Functionality:

    • The endpoint should accept a user identifier as input.
    • It should return the user's information stored in the SOLR index.
    • The endpoint should exclude unnecessary fields (e.g., version information) from the response.
  2. Error Handling:

    • The endpoint should handle errors gracefully, providing meaningful error messages to users.
    • Specific error handling should include scenarios where no user identifier is provided or the user is not found.
  3. User Experience:

    • The endpoint should respond quickly to ensure a seamless user experience.
    • The response should include clear and relevant user information.
  4. Data Integrity:

    • Ensure that the retrieved user data is accurate and up-to-date.
    • The endpoint should only return data for the specified user.
  5. Security:

    • Implement appropriate security measures to protect user data and prevent unauthorized access to the SOLR index.
  6. Scalability:

    • The endpoint should be designed to handle a high volume of requests without impacting performance.

Acceptance Criteria:

  • The endpoint successfully retrieves user information from the SOLR index based on the provided identifier.
  • The endpoint returns relevant and accurate user data.
  • Error messages are clear and informative for users.
  • The endpoint responds within an acceptable time frame.

Assumptions and Dependencies:

  • The SOLR index is properly configured and populated with user data.
  • Necessary infrastructure and resources are available to support the endpoint.

Risks and Mitigation Strategies:

  • Risk: Technical

Clone this wiki locally