Content
You are here:
api & /api/v3/projects/{id}/copy endpoint & project_statuses_pkey
Added by marc rcdevs almost 2 years ago
Hi,
I am using
OpenProject 12.3.3
PostgreSQL version 13.7
When I try to use the api to copy a project to create a new one I get this error:
( where my endpoint is /api/v3/projects/23/copy as 23 is the id of template I am trying to use and in the header I just have the name of the new project)
2022-11-23 16:00:52.927 UTC [38] ERROR: duplicate key value violates unique constraint "project_statuses_pkey"
2022-11-23 16:00:52.927 UTC [38] DETAIL: Key (id)=(23) already exists.
2022-11-23 16:00:52.927 UTC [38] STATEMENT: INSERT INTO "project_statuses" ("id", "project_id", "explanation", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"
Is this a bug or am I doing something wrong ?
Replies (3)
Hey,
The sentence: please share your APIv3 call in your code
'I try to use the api to copy a project to create a new one' is not an APIv3 syntax :)
I cannot answer your question if I do not see the APIv3 call
Yes apologies !
When I try by an API call to create a copy of a project, I get this error:
....
Here is my api call, it very simple. the error is in my db log
If I try with a different project I have the same problem
Url endpoint: /api/v3/projects/139/copy
Same payload json {'name': 'test', 'customField9': 'test'}
logs db:
2022-11-29 13:56:23.817 UTC [38] ERROR: duplicate key value violates unique constraint "project_statuses_pkey"
2022-11-29 13:56:23.817 UTC [38] DETAIL: Key (id)=(93) already exists.
2022-11-29 13:56:23.817 UTC [38] STATEMENT: INSERT INTO "project_statuses" ("id", "project_id", "explanation", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"
with in the db:
openproject=# SELECT * FROM project_statuses where project_id=139;
id | project_id | explanation | code | created_at | updated_at
----+------------+-------------+------+-------------------------------+-------------------------------
93 | 139 | | | 2022-11-29 13:52:24.923032+00 | 2022-11-29 13:52:24.923032+00