Description
Currently, PIMO offers a command-line interface (CLI) for masking JSON data based on a configuration in a masking.yml file. To enhance its flexibility, I propose adding a dynamic API feature, introducing a new pimo serve command.
Proposed Features
- Addition of a new
pimo serve command to start a dynamic API server.
- Endpoint POST /context/ to dynamically create a context using a
masking.yml file.
- Example request:
curl -X POST -H 'Content-Type: application/x-yaml' -d @'my-masking-file.yml' http://localhost:8080/context
- Endpoint POST /context/{contextID} to mask data based on a specific
masking.yml file for a context.
- Example request:
curl -X POST -H 'Content-Type: application/json' -d @'input.json' http://localhost:8080/context/context-id
- Endpoint DELETE /context/{contextID} to delete a specific context.
- Example request:
curl -X DELETE http://localhost:8080/context/context-id
How to Test
- Run
pimo serve to start the dynamic API server.
- Send POST requests to create a context, POST requests to mask data, and DELETE requests to delete a context using curl or a similar tool.
- Examples:
- Create context:
curl -X POST -H 'Content-Type: application/x-yaml' -d @'my-masking-file.yml' http://localhost:8080/context
- Mask data:
curl -X POST -H 'Content-Type: application/json' -d @'input.json' http://localhost:8080/context/context-id
- Delete context:
curl -X DELETE http://localhost:8080/context/context-id
Expected Results
- POST requests to create a context and mask data should return an HTTP 200 response with the masked data.
- DELETE requests to delete a context should return an HTTP 204 response on success.
Description
Currently, PIMO offers a command-line interface (CLI) for masking JSON data based on a configuration in a
masking.ymlfile. To enhance its flexibility, I propose adding a dynamic API feature, introducing a newpimo servecommand.Proposed Features
pimo servecommand to start a dynamic API server.masking.ymlfile.curl -X POST -H 'Content-Type: application/x-yaml' -d @'my-masking-file.yml' http://localhost:8080/contextmasking.ymlfile for a context.curl -X POST -H 'Content-Type: application/json' -d @'input.json' http://localhost:8080/context/context-idcurl -X DELETE http://localhost:8080/context/context-idHow to Test
pimo serveto start the dynamic API server.curl -X POST -H 'Content-Type: application/x-yaml' -d @'my-masking-file.yml' http://localhost:8080/contextcurl -X POST -H 'Content-Type: application/json' -d @'input.json' http://localhost:8080/context/context-idcurl -X DELETE http://localhost:8080/context/context-idExpected Results