Project

General

Profile

Redmine api post request with json boolean values not recognised

Added by paul biskup 6 days ago

Hi all,

when I send a POST request to our redmine server with the specifications:
Redmine version 5.0.1.stable
Ruby version 3.0.2-p107 (2021-07-07) [x86_64-linux-gnu]
Rails version 6.1.6

Everything works fine(I don't get an error or anything), but the boolean values are not recognised. I am sending a json body:

{
    "user": {
        "login": "jplang",
        "firstname": "Jean-Philippe",
        "lastname": "Lang",
        "mail": "example@example.com",
        "must_change_password": true, 
        "generate_password": true,
        "send_information": true,
        "custom_fields": [
          {
              "id": 39,
              "name": "User Type",
              "value": "External - Customer" 
          },
          {
              "id": 67,
              "name": "HR Number",
              "value": null
          }
      ]
    }
}

Replies (2)

RE: Redmine api post request with json boolean values not recognised - Added by Holger Just 6 days ago

Where are you posting this data to, i.e. which URL? Redmine validates fields and generally ignores fields in a POST payload which the current user is not authorized to change.

RE: Redmine api post request with json boolean values not recognised - Added by paul biskup 6 days ago

I am posting it to /users.json. The user gets created normally. It is just that the password is not generated and no email is sent. When i create a User normally those fields work just fine.

    (1-2/2)