Search results

Stock Checking - REST API User Guide

Authentication

To authorise your requests, make sure to include your unique user id as a header in each request.

Endpoint

Endpoint: GET https://stockapi.rjpconnect.com/v1/checkstock/:productcode

The :productcode parameter should be replaced with the actual stock code of the product you want to check.

Example

To check the stock information for a product with the stock code "S008801", make a GET request to the following URL:

GET https://stockapi.rjpconnect.com/v1/checkstock/S008801

Headers:

User-Id: your-user-id

Behavior for Partial and Full Product Codes

If you provide a partial product code consisting of the first 5 characters, the API will return all available colour options for products that match the provided partial code. The response will include multiple items with different colour codes but the same first 5 characters.

If you provide the full 7-digit product code, the API will return information for the specific product with the exact matching code.

Response

The API endpoint will respond with a JSON object or an array of JSON objects containing the stock information for the specified product(s).

Example Response (Partial Product Code):

[
    {
        "code": "S008801",
        "name": "Ball 70mm - Black - Stress",
        "stock": 30566
    },
    {
        "code": "S008802",
        "name": "Ball 70mm - Red 185c - Stress",
        "stock": 16300
    }
]

Example Response (Full Product Code):

{
    "code": "S008802",
    "name": "Ball 70mm - Red 185c - Stress",
    "stock": 16300
}

Error Handling

If there is an error or the specified product code is not found, the API will respond with an error message and the appropriate HTTP status code.

Here are some common error scenarios:

If the specified :productcode does not exist:

HTTP Status Code: 404 Not Found
Response Body: {"error": "Product not found."}

If the request is unauthorized or User-Id header is missing:

HTTP Status Code: 401 Unauthorized
Response Body: {"error": "Not authorized."}

If there is a server error or an unexpected issue:

HTTP Status Code: 500 Internal Server Error
Response Body: {"error": "An unexpected error occurred."}

That concludes the user guide for the Check Stock REST API. It provides you with a simple and straightforward way to retrieve stock information for products based on their stock code.

If you have any further questions or need assistance with your user ID, please don't hesitate to contact our support team at support@rjpint.com.