8000 Collect API endpoint response status code · Issue #505 · aboutcode-org/purldb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Collect API endpoint response status code #505
Closed
@tdruez

Description

@tdruez

This endpoint returns a 200 status code on error.

For example: /api/collect/?purl=pkg:npm/foo@1.0

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "status": "error(s) occurred when fetching metadata for pkg:npm/foo@1.0: Package does not exist on npmjs: pkg:npm/foo@1.0"
}

We should have an appropriate status code to make things easier on the consumer side.

By the way, calling /api/collect/ with a purl return a proper 400 status code:

HTTP 400 Bad Request
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "errors": {
        "purl": [
            "This field is required."
        ]
    }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghigh priorityHigh Priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0