Validate Product Operation
Validate Product
This operation allows to validation of a product without building/re-building it. The validate product checks if a single product complies with a number of fixed and user-configurable checks and will create product messages if errors occur.
Resource Representation
Only products in status Edit can be validated. This can be derived by the presence or absence of the Validate link.
The resource representation of a product that can be validated, looks like this:
{ ... product properties ... "links": [ { "href": "http://<host>:<port>/api/generic/products/{id}", "rel": "self" }, { "href": "http://<host>:<port>/api/products/{id}/validate", "rel": " product:validate" "httpMethod": "POST" } ] }
In the resource representation of a product that cannot be validated, the Validate link is not provided:
{ ... product properties ... "links": [ { "href": "http://<host>:<port>/api/generic/products/{id}", "rel": "self" } ] }
Validation Process
Using this operation, the user can validate the product without building it. During the validation process, the following steps are performed:
-
Remove all pre-existing messages
-
Update/Match parameter alias usages
-
Execute pre-defined/system validation checks
-
Execute user-defined validation checks
-
Add validation messages to the Product if validation fails
-
Update the product’s validation status
For more details, see Validate Product under Operations Guide.
The validation of a product can be divided into three use cases:
-
Use Case 1: It is possible to validate the product when it is only in the Edit status
-
Use Case 2: If the product validation is already in progress. Re-triggering the validation process is only possible once the current validation process is complete. There is an additional link to the "status" resource, which clients can use to monitor the progress or analyze the last error
-
Use Case 3: If the product is already built and triggering the validation process for the product is not possible at this state. Example: Product in status Review
The following table gives an overview of the possible validation of product:
Status | Validate Product Possible? | Link Validation Status Resource Available |
---|---|---|
Approved |
No |
No |
Edit |
Yes |
Yes |
Queued |
No |
No |
Review |
No |
No |
Test |
No |
No |
When a product cannot be submitted for the validation process, the system returns the following error:
Code | Severity | Message Text |
---|---|---|
PRD-HTTP-001 |
Fatal |
Product must be in status edit to start the "validate" process |
When a product is currently being processed, or the last processing did not end in a valid end status, a status link is included:
{ ... product properties ... "links": [ { "href": "http://<host>:<port>/api/generic/products/{id}", "rel": "self" }, { "href": "http://<host>:<port>/api/products/{id}/validationstatus", "rel": "product:validationstatus", "httpMethod": "GET" } ] }
API Conversation and Interaction
This API’s conversational and interaction style is based on its asynchronous nature. The client of this API will become detached from the actual background process. The client can use the validationstatus resource to monitor that background process. So the API client is not blocked but is provided with the means to track progress asynchronously.
After this process, this means that either the product has been validated successfully or there were errors during processing. Both of these outcomes are made available/accessible for the consumer of this API.
Resources used in this API
Product Resource
A product resource is a singular resource representing a product. For more details about the representation, see Default Resource Representation (GET). The product resource contains the validate link or the link to the status resource.
Validation Status Resource
These resources provide the basic elements with which validating a product can be fulfilled - including tracking progress and the ability to show processing errors. As these are individual states of the application, define the various link relations to allow a consumer to converse with the system.
Link Relations used in this API
In the case of validating a product for processing, the following link relations are defined:
-
rel="product:validate"
To eventually have a product in the context of this link relation - processed by the system.
-
rel="product:validationstatus"
To request the status of the current or last product validate action.
-
rel="self"
Link to the current resource. For instance, this can be used on the status resource to poll the resource for progress tracking periodically.
-
rel="related"
This is a standard link relation to the related (product) resource. This should be provided once the request is completed successfully.
Using the IP to Validate a Product
The Product is in a status Edit, i.e., the validation process can be started.
Interaction Messages
The client requests a product. The product is returned like this:
{ ... Product properties ... "links": [ { "href": "http://<host>:<port>/generic/products/{id}", "rel": "self" }, { "href": "http://<host>:<port>/products/{id}/validate", "rel": "product:validate", "httpMethod": "POST" } ] }
The client initiates the validation process for the product by calling POST on "api-context-root/products/{id}/validate". The product processing is started, and the server responds with status 201 (Created).
A link to the status resource is returned in the response header like this:
Location: api-context-root/product/{id}/validationstatus.
The clients can now track the progress by issuing a GET to the status URI returned in the response header. While the product is being processed, the status resource will be returned like this:
{ "progress": "processing", "links": [ { "href": "http://<host>:<port>/products/{id}/validationstatus", "rel": "self" }, { "href": "http://<host>:<port>/generic/products/{id}/", "rel": "related" } ] }
When the processing ends successfully (no errors), the status resource will return:
{ "progress": "succeeded", "links": [ { "href": "http:http://<host>:<port>/products/{id}/validationstatus", "rel": "self" }, { "href": "http://<host>:<port>/products/generic/{id}/", "rel": "related" } ] }
When the processing ends unsuccessfully, the status resource returns:
{ "progress": "failed", "o:errorDetails": [ { "detail": "<detailed message 1>", "o:errorCode": "" }, { "detail": "<detailed message 2>", "o:errorCode": "" } ], "links": [ { "href": "http://<host>:<port>/products/{id}/validationstatus", "rel": "self" }, { "href": "http://<host>:<port>/generic/products/{id}/", "rel": "related" } ] }
If the validation process has not been initiated for a new product, the status resource returns:
{ "progress": "notStarted", "links": [ { "href": "http://<host>:<port>/products/{id}/validationstatus", "rel": "self" }, { "href": "http://<host>:<port>/generic/products/{id}/", "rel": "related" } ] }
Response Messages
This operation provides HTTP status codes as defined in Response Messages.
If an error occurs, the appropriate HTTP status code is returned.
The following operation specific error can occur:
Code | Severity | Message Text |
---|---|---|
PRD-HTTP-001 |
Fatal |
Product must be in status edit to start the "validate" process |