Update project over REST api

Added by Jeremy Ekers about 1 year ago

I am not able to update a project to change its "is_public" flag using the REST API (Redmine v3.3.3).

I can update issues, but sending

{ "projects": { "id": 142, "is_public": "false" } }

to url http://redmine/projects/[142].json

gives back a 404 error.

Any hints welcome.

Replies (1)

RE: Update project over REST api - Added by Mayama Takeshi about 1 year ago

Maybe it is not supported in 3.3.3.

In my 4.1.1 installation, it works fine:

$ curl -s -x '' -u admin http://192.168.2.120:3000/projects/1.json | jq .
Enter host password for user 'admin':
{
  "project": {
    "id": 1,
    "name": "the_app",
    "identifier": "the_app",
    "description": "test",
    "homepage": "",
    "status": 1,
    "is_public": true,
    "inherit_members": false,
    "created_on": "2020-09-10T01:32:14Z",
    "updated_on": "2020-09-26T23:32:36Z" 
  }
}

$ curl -s -x '' -u admin http://192.168.2.120:3000/projects/1.json -X PUT -H 'Content-Type: application/json' -d '{"project": {"is_public": false}}'
Enter host password for user 'admin':

$ curl -s -x '' -u admin http://192.168.2.120:3000/projects/1.json | jq .
Enter host password for user 'admin':
{
  "project": {
    "id": 1,
    "name": "the_app",
    "identifier": "the_app",
    "description": "test",
    "homepage": "",
    "status": 1,
    "is_public": false,
    "inherit_members": false,
    "created_on": "2020-09-10T01:32:14Z",
    "updated_on": "2020-09-26T23:33:13Z" 
  }
}

(1-1/1)