Content
View differences
Updated by Jens Ulferts about 3 years ago
### Background:
I am setting up a Jenkins job/webhook that updates OP work packages once they're identified in our Repo commits.
I am having an issue where a PATCH API call to /api/v3/work\_packages/ returns a 200 response, but the task does not change. If I copy the exact payload from my Jenkins script output, and place it in my /api/docs page to test it, it does do the change.
### Steps to reproduce
_Please write down the steps to reproduce. Try to write down all necessary preconditions (what permissions do you have, are other users involved?). Example:_
1. Set up an environment with a work package that you wish to change via the API.
2. Submit a GET API request for the Work Package using Basic API key authentication (API Key holder is Project Admin).
3. Get valid response and store the lockVersion value.
4. Submit a PATCH API request without a with the following payload (not even an empty object `{}`) (your values changed):
```JSON
{
"lockVersion": 9,
"customField4": 807,
"_links": {
"status": {
"href": "/api/v3/statuses/9"
}
}
}
```
* Observe a 200 request response.
### What is the buggy behavior?
_Please describe the bug in as much detail as possible. Example:_
* A 200 response is returned returned, but the Work Package does not update.
* Using the exact same request body in the API Docs/test page DOES change the work package properly.
### What is the expected behavior?
_Describe how the application should behave like. Example:_
1. A response with a The work package's customfield4 and status code of 400 should be returned as the request is malformed. have changed.
### Notes **Logs**
Ideally that behaviour Jenkins Process Log:
```text
[Pipeline] { (PushTaskData)
[Pipeline] readJSON
[Pipeline] echo
{
"id": 1896,
"lockVersion": 11,
"customField4": 807,
"_links": {
"status": {
"href": "/api/v3/statuses/9"
}
}
}
[Pipeline] httpRequest
HttpMethod: PATCH
URL: http://redacted:8010/api/v3/work_packages/1896?notify=false
accept: application/hal+json
Content-Type: application/json
Using authentication: OpenProjectAPIKey
Sending request to url: http://redacted:8010/api/v3/work_packages/1896?notify=false
Response Code: HTTP/1.1 200 OK
Success: Status code 200 is applied consistently throughout in the API.
accepted range: 100:399
```
### Environment information
_Please check and fill out the following details to help us identify in what versions and distributions of OpenProject the error occurs_
**OpenProject installation type**
* [ ] Hosted cloud edition
* [ ] Packaged installation
* What distribution?
* [x] Docker All-in-one container
* [ ] Docker-compose installation
* [ ] Other (please specify)
**OpenProject version**
**12.4.0**
**Browser**
* [ ] Chrome
* [ ] Firefox
* [ ] Safari
* [ ] Mobile Safari
* [x] Other - API Jenkins/API HTTP Request
**Language**
English
I am setting up a Jenkins job/webhook that updates OP work packages once they're identified in our Repo commits.
I am having an issue where a PATCH API call to /api/v3/work\_packages/ returns a 200 response, but the task does not change. If I copy the exact payload from my Jenkins script output, and place it in my /api/docs page to test it, it does do the change.
###
_Please write down the steps to reproduce. Try to write down all necessary preconditions (what permissions do you have, are other users involved?). Example:_
1. Set up an environment with a work package that you wish to change via the API.
2. Submit a
3. Get valid response and store the lockVersion value.
4. Submit a
{
"lockVersion": 9,
"customField4": 807,
"_links": {
"status": {
"href": "/api/v3/statuses/9"
}
}
}
```
* Observe a 200 request response.
_Please describe the bug in as much detail as possible. Example:_
* A 200 response is returned
* Using the exact same request body in the API Docs/test page DOES change the work package properly.
### What is the expected behavior?
_Describe how the application should behave like. Example:_
1. A response with a
### Notes
Ideally that behaviour
```text
[Pipeline] { (PushTaskData)
[Pipeline] readJSON
[Pipeline] echo
{
"id": 1896,
"lockVersion": 11,
"customField4": 807,
"_links": {
"status": {
"href": "/api/v3/statuses/9"
}
}
}
[Pipeline] httpRequest
HttpMethod: PATCH
URL: http://redacted:8010/api/v3/work_packages/1896?notify=false
accept: application/hal+json
Content-Type: application/json
Using authentication: OpenProjectAPIKey
Sending request to url: http://redacted:8010/api/v3/work_packages/1896?notify=false
Response Code: HTTP/1.1 200 OK
Success: Status code 200
```
_Please check and fill out the following details to help us identify in what versions and distributions of OpenProject the error occurs_
**OpenProject installation type**
* [ ] Hosted cloud edition
* [ ] Packaged installation
* What distribution?
* [x] Docker All-in-one container
* [ ] Docker-compose installation
* [ ] Other (please specify)
**OpenProject version**
**12.4.0**
**Browser**
* [ ] Chrome
* [ ] Firefox
* [ ] Safari
* [ ] Mobile Safari
* [x] Other - API
**Language**
English