Skip to content

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

@youen

Description

@youen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions