Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROPOSAL] New pimo serve command for a dynamic API feature #283

Open
youen opened this issue Jan 22, 2024 · 0 comments
Open

[PROPOSAL] New pimo serve command for a dynamic API feature #283

youen opened this issue Jan 22, 2024 · 0 comments

Comments

@youen
Copy link
Collaborator

youen commented Jan 22, 2024

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant