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

API /v1/bom should have a parameter parent #2412

Closed
2 tasks done
oers opened this issue Jan 27, 2023 · 6 comments · Fixed by #2545
Closed
2 tasks done

API /v1/bom should have a parameter parent #2412

oers opened this issue Jan 27, 2023 · 6 comments · Fixed by #2545
Labels
enhancement New feature or request
Milestone

Comments

@oers
Copy link

oers commented Jan 27, 2023

Current Behavior

At the moment the API does not hava a parameter to specifiy the parent, when uploading a bom and using projectname/version.

Proposed Behavior

Add a parameter "parent" to /v1/bom which consumes and sets the parant on upload.

Checklist

@oers oers added the enhancement New feature or request label Jan 27, 2023
@ch-k
Copy link

ch-k commented Jan 27, 2023

Would be very helpful und maybe even necessary for something like that: jenkinsci/dependency-track-plugin#139

Workaround is to create project via /v1/bom (by project name and version), retrieve IDs using /v1/project/lookup and finally update the project (including parent) with POST to /v1/project. But that's not very convenient.

@weinzierl
Copy link

weinzierl commented Jan 27, 2023

"...finally update the project (including parent) with POST to /v1/project"

Have you tried that? I can't get it to work, because /v1/project doesn't seem to accept neither "parent": "uuid" nor "parentUuid": "uuid" (400 Bad Request).
/v1/project/uuid with a PUT gives me a 500. Specifying a "uuid" field does create the project but the uuid doesn't seem to be used. Setting the project uuid in the parent as "children": ["uuid"] didn't work either. How can I create a child project via the API at all?

@ch-k
Copy link

ch-k commented Jan 27, 2023

"...finally update the project (including parent) with POST to /v1/project"

Have you tried that? I can't get it to work, because /v1/project doesn't seem to accept neither "parent": "uuid" nor "parentUuid": "uuid" (400 Bad Request). /v1/project/uuid with a PUT gives me a 500. Specifying a "uuid" field does create the project but the uuid doesn't seem to be used. Setting the project uuid in the parent as "children": ["uuid"] didn't work either. How can I create a child project via the API at all?

I didn't test this step manually via curl or similar. But that's the way that the Dependency Track frontend takes. It uses the same API. When you open the "Project Details" dialog of a project without parent, you can select a new parent and press the "Update" button (that's the call to /v1/project).

@roadSurfer
Copy link

roadSurfer commented Jan 31, 2023

#2401 was recently addressed which allows setting the parent via a PATCH after the project has been created,
The parent can be set via POST, the frontend does this, but that requires having to include all the other project details as well; not just those which have changed.
FWIW I have tried the POST method and it works, but I have elected to ignore parent for now until the next release.

Edit: Being able to do it on bom upload (via name/version or UUID) could be advantageous as it would avoid the need for multiple quests.

@codenox-vs
Copy link

I was searching for this feature right now (/bom and parent). I thought I just missed it, but looks like I have to what a bit longer...

@github-actions
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants