# ABTProducts PUT request body generator
Simple tool to quickly edit HTM products via ABTProducts REST API.

- Requires JRE 17

## Generating a PUT output (that you need to supply to PUT API yourself):
- Run via: `java -jar ABTProductsPUTGenerator.jar`
  - Specify custom input/output path via: `java -jar ABTProductsPUTGenerator.jar <inputPath> <outputPath>`
- Takes a ABTProducts GET response body in JSON format (product details)
- Generates the equivalent PUT request body - send via either:
  - Postman WSO2 ABTProducts collection
  - `curl -X PUT -H 'Content-Type: application/json' {baseUrl}/abt/abtproducts/1.0/38 --data @output.json`
- Default input path: /input.json
- Default output path: /output.json (output is overwritten if it exists)
  
## Bulk clearing (set to null) of a certain product attribute for all productIds in a product-tree (SE product reponse)
- Run via: `java -jar ABTProductsPUTGenerator.jar clearAttribute <inputPath> <attributeToClear> <environment> <wso2BearerToken>`
- Takes a SE GET product tree response body or ABTProducts GET response body in JSON format
- Also needs the attribute to clear and the WSO2 environment and valid WSO2 bearer token for that environment
- Performs the following operations:
  - Finds all productId's in the given product(tree) and for each productId found:
    - GETs productdetails via ABTProducts API
    - Converts it to PUT request body using the functionality in the previous section
    - Replaces <attributeToClear> with `null`
    - Actually sends the modified PUT request body to ABTProducts PUT API
