Part-DB-server icon indicating copy to clipboard operation
Part-DB-server copied to clipboard

API - patching project_bom_entries is not working correctly

Open electronics4fun opened this issue 1 year ago • 0 comments

Discussed in https://github.com/Part-DB/Part-DB-server/discussions/656

Originally posted by electronics4fun July 29, 2024 I have trouble to get the api with "/api/project_bom_entries/{id}" to work.

What i have done so far: I have already created a a ProjectBOMEntry via "/api/project_bom_entries". This entry is visible in the database in table project_bom_entries with id 14.

I was not able to setup the BOMEntry directly to a project, that was why i started to go a workaround with patching the BOMEntry.

So i used the build in api (http://xxx/api/docs#/ProjectBOMEntry/api_project_bom_entries_id.__format_patch) to patch the entry.

For id i used the id from before: 14. In the body i used the following minimal approach:

{
  "data": {
    "relationships": {
      "project": {
        "data": {
          "id": "api/project/8"
        }
      }
    }
  }
}

(I want to add the BOMEntry to project 8 which is present in the database)

The funny part is, that the post returns with code 200, but no change in the table project_bom_entries or PartDb itself is visible.

Version used: 1.13.1

electronics4fun avatar Aug 01 '24 12:08 electronics4fun