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

Create the ExtractMetadata API #2793

Open
2 tasks
mikehgrantsgov opened this issue Nov 8, 2024 · 2 comments
Open
2 tasks

Create the ExtractMetadata API #2793

mikehgrantsgov opened this issue Nov 8, 2024 · 2 comments
Labels
api topic: backend Backend development tickets

Comments

@mikehgrantsgov
Copy link
Collaborator

mikehgrantsgov commented Nov 8, 2024

Related to 2454

Summary

2792 creates the input/output schemas needed to support the API. This ticket creates the API to read params from the request and send back extract metadata information.

Something like:

POST /v1/extracts/opportunities

Input:
ExtractMetadataRequestSchema

If extract_type is not provided, default to opportunity_data_extract (we may support more later)
If start_date and end_date not provided, default to where created_at is within the last 7 days.

Something like (rough pseudocode):

@opportunity_blueprint.post("/extracts/opportunities")
@opportunity_blueprint.output(extract_metadata_schemas.ExtractMetadataListResponseSchema)
@opportunity_blueprint.auth_required(api_key_auth)
@flask_db.with_db_session()
def extract_metadata_get(db_session: db.Session) -> ApiResponse:
    # Get query parameters

    # Default to last 7 days if no date range is provided

    # Call service with params to get results

    # Serialize results

    # return ApiResponse(message="Success", data=metadata_list)

Acceptance criteria

  • API created with supporting service
  • Test to seed the db and read these values. Tests include parameter permutations
@chouinar
Copy link
Collaborator

We'll want to be careful about doing GET with a request body. It's fuzzy whether that's technically "right" in HTTP requests. Some libraries apparently won't let you do that. Either need everything to be request params or just make it a POST endpoint (I generally just prefer the latter).

I'm trying to think if we'll have more extracts in the future to warrant a naming schema like:

  • /v1/extracts/opportunities
  • /v1/extracts/something-else-down-the-road

@mikehgrantsgov
Copy link
Collaborator Author

Makes sense, adapted this for /v1/extracts/opportunities now and can add more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api topic: backend Backend development tickets
Projects
Development

No branches or pull requests

2 participants