Project

General

Profile

Actions

Defect #37633

closed

API create issue relation method returns "406:Not Acceptable" error

Added by Tomoko Shimizu over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Cant reproduce
Affected version:

Description

I tried to create issue relation by Curl, but it failed.
Could you please let me know if there is a workaround?


My environment:

Redmine 4.2.5
MySQL 5.7
Ruby 2.7.5
Apache/2.4.54

Curl command
note: API key has been replaced by "xxx".

curl -v -H "Content-Type: application/json" -X POST --data-binary "@rel.json" -H "X-Redmine-API-Key: xxx" http://ServerName/issues/1880736/relations.json

rel.json

{
    "relation": {
            "issue_to_id": "1880711",
            "relation_type": "follows",
            "delay": 0
      }
}

Returned error message on console

\< HTTP/1.1 406 Not Acceptable

Error messeage in production.log
note: my name has been replaced by xxx.

Started POST "/issues/1880736/relations.json" for 127.0.0.1 at 2022-09-01 15:52:18 +0900
Processing by IssueRelationsController#create as JSON
  Parameters: {"relation"=>{"issue_to_id"=>"1880711", "relation_type"=>"follows", "delay"=>0}, "issue_id"=>"1880736"}
  Current user: xxx (id=xxx)
Completed 406 Not Acceptable in 990ms (ActiveRecord: 15.1ms)

ActionController::UnknownFormat (IssueRelationsController#create is missing a template for this request format and variant.

request.formats: ["application/json"]
request.variant: []):
</pre
Actions #1

Updated by Mizuki ISHIKAWA over 1 year ago

Thank you for writing a clear reproduction method.
However, I could not reproduce the issue in my environment (Redmine 4.2.5, Ruby 2.7.5)

$ curl -v -H "Content-Type: application/json" -X POST --data-binary "@rel.json" -H "X-Redmine-API-Key: xxx" http://localhost:3000/issues/1/relations.json
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 127.0.0.1:3000...
* Connected to localhost (127.0.0.1) port 3000 (#0)
> POST /issues/1/relations.json HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.79.1
> Accept: */*
> Content-Type: application/json
> X-Redmine-API-Key: xxx
> Content-Length: 125
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 201 Created
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Permitted-Cross-Domain-Policies: none
< Referrer-Policy: strict-origin-when-cross-origin
< Content-Type: application/json; charset=utf-8
< Location: http://localhost:3000/relations/1
< ETag: W/"0036f8661ce63c9249d262c9dd7a2c2d" 
< Cache-Control: max-age=0, private, must-revalidate
< X-Request-Id: 4e9cc4fb-7564-453a-a0be-88fb46f86472
< X-Runtime: 0.060981
< Content-Length: 87
<
* Connection #0 to host localhost left intact
{"relation":{"id":1,"issue_id":2,"issue_to_id":1,"relation_type":"precedes","delay":0}}%
Actions #2

Updated by Mizuki ISHIKAWA over 1 year ago

Could you please try to reproduce the problem with a newly built Redmine with Docker as follows.
This is a verification to isolate whether the problem is client side or affected by Redmine configuration, etc.

docker run -p 3000:3000 --name redmine redmine:4.2.5
  • Access to http://localhost:3000
  • Create a project and issues, etc. (Create the data needed to set up issue relationships)
  • Make the API available and create an API key
  • Create issue relation by curl command
Actions #3

Updated by Tomoko Shimizu over 1 year ago

  • Status changed from New to Resolved

Thank you, Mizuki Ishikawa -san.

We had applied a few patch to Redmine, and when we applied the same patch to 4.2.5, it was causing the bug.
Sorry for raising a Defect ticket here. Please close or delete the ticket.

Actions #4

Updated by Mischa The Evil over 1 year ago

  • Status changed from Resolved to Closed
  • Resolution set to Cant reproduce

Thanks for the feedback.

Actions

Also available in: Atom PDF