-
Notifications
You must be signed in to change notification settings - Fork 8
update
/update/ endpoint in SWAGGER-UI
curl -X 'PUT' \ 'http://peviitorqa.go.ro/api/v0/update/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "job_title": "<string>", "company": "<string>", "city": "<string>", "job_link": "<string>" }'
-
Method:
PUT -
Endpoint name:
/update -
Request Body Parameters:
-
job_title– Title of the job (required). -
company– Company name (required). -
city– City where the job is located (required). -
job_link– URL to the job listing (required).
-
-
Response Format:
application/json; charset=utf-8
{
"job_title": "<string>",
"company": "<string>",
"city": "<string>",
"job_link": "<string>"
}-
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– OnlyPUTrequests 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>"
}- Validates the
PUTmethod and handles preflightOPTIONSrequests. - Normalizes city names to match SOLR records.
- Sends JSON payload to SOLR’s
/updateendpoint withcommitWithin=1000andoverwrite=trueoptions.
-
CORS policy: Open to all (
Access-Control-Allow-Origin: *). -
Method Restriction: Only
PUTrequests allowed.
- SOLR Search Server – Required to add job data.
-
PHP
curlandstream_context_create– Used to communicate with SOLR API.
-
SOLR Downtime: Returns
503if SOLR is unavailable. -
Missing or Invalid Fields: Returns
400if any required field is missing or invalid. - Non-empty string: All fields must be non-empty.
- Security Risks: No authentication currently implemented.
- To do: Add API keys.
- To do: Log errors for easier debugging.
-
To do: Implement
security.jsonand IP whitelisting.
The objective of this project is to develop an API endpoint that adds job listings in a SOLR index. This endpoint will be used to manage job data efficiently by updating existing job listings.
-
Functionality:
- The endpoint should accept job details such as job title, company, city, and job link as input.
- It should add the corresponding job listing in the SOLR index.
- The endpoint should support normalization of city names to ensure consistency.
-
Error Handling:
- The endpoint should handle errors gracefully, providing meaningful error messages to users.
- Specific error handling should include scenarios where required parameters are missing or the add operation fails.
-
User Experience:
- The endpoint should respond quickly to ensure a seamless user experience.
- The response should include a clear success message or error details.
-
Data Integrity:
- Ensure that the added job data is accurate and consistent.
- The endpoint should only add data for the specified job listing.
-
Security:
- Implement appropriate security measures to protect user data and prevent unauthorized access to the SOLR index.
-
Scalability:
- The endpoint should be designed to handle a high volume of requests without impacting performance.
- The endpoint successfully adds job listings in the SOLR index.
- The endpoint returns a clear success message or error details.
- Error messages are clear and informative for users.
- The endpoint responds within an acceptable time frame.
- The SOLR index is properly configured and populated with job data.
- Necessary infrastructure and resources are available to support the endpoint.
-
Risk: Technical issues with the SOLR index could prevent job adds.
- Mitigation: Regularly monitor the SOLR index for errors and perform maintenance as needed.
-
Risk: High traffic could impact performance.
- Mitigation: Implement load balancing and optimize server resources to handle increased traffic.
-
Risk: Unauthorized access could lead to data breaches.
- Mitigation: Implement robust security measures, including authentication and authorization checks.