Project

General

Profile

API Relations: NoMethodError (private method `require' called for nil:NilClass)

Added by André Sydoriak 9 days ago

Hi,

when using API with relations.json error "NoMethodError (private method `require' called for nil:NilClass)" is thrown in Apache2 error.log. API answers with error 500 internal server error.

Creating Issues with API works without errors.

Complete log:

Processing by IssueRelationsController#create as JSON
Parameters: {"relation_type"=>"blocks", "issue_to_id"=>5068, "issue_id"=>"5067"}
Current user: user(id=85)
Completed 500 Internal Server Error in 8ms (ActiveRecord: 1.7ms | Allocations: 3863)
NoMethodError (private method `require' called for nil:NilClass):
app/controllers/issue_relations_controller.rb:113:in `relation_issues_to_id'
app/controllers/issue_relations_controller.rb:51:in `create'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

Any hints?

Thanks,
ANSY


Replies (2)

RE: API Relations: NoMethodError (private method `require' called for nil:NilClass) - Added by Holger Just 9 days ago

You are sending unexpected parameters with your request. See Rest_IssueRelations for a description of the API.

You need to wrap the POSTed data in a relation object, e.g.

{
  "relation": {
    "relation_type": "blocks",
    "issue_to_id": 5068,
    "issue_id": 5067
  }
}

This generally true of all APIs in Redmine, i.e. generally all of them expect a top-level object with the name of the created resource.

RE: API Relations: NoMethodError (private method `require' called for nil:NilClass) - Added by André Sydoriak 8 days ago

Hi Holger,

thanks, my fault. That was a missing coffee issue. Now it is working. Thank you very much for helping me out.

    (1-2/2)