Re: Roundup rest API

SCHLEMMER Norbert <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hi John

Changed from #delete to #patch with { "@op":"action", "@action_name":"retire" } and it works just as using # delete

Thanks again
Norbert


-----Ursprüngliche Nachricht-----
Von: [email protected] <[email protected]> 
Gesendet: Donnerstag, 13. Juli 2023 21:57
An: SCHLEMMER Norbert <[email protected]>
Cc: [email protected]
Betreff: Re: AW: AW: [Roundup-users] Roundup rest API

*EXTERNAL source*


Hi Norbert:

In message <[email protected]>,
SCHLEMMER Norbert writes:
>>>The #patch command with "@op=remove" will be executed with return 
>>>code
>>>"200 OK"

I think this is correct. Without seeting the entire transaction (including payload) it is difficult to tell. I think you told it to remove the items in the payload without supplying a payload. So it removed nothing and reported an empty data section because nothing had changed.

>>Just a note, using the DELETE verb will do the same [...]
>>
>Using the DELETE command and having ADMIN role assigned makes it working well.
>The "deleted" issue will be set to retire and is excluded from search

I mispoke (mistyped??). To do the equivalent of DELETE using PATCH "@op=action" and "@action_name=retire" is used to retire an item. Compare this to @op=remove is used to modify the data according to the data payload.

If you use:

    curl -X DELETE -H 'If-match: "etag here"' -H 'x-requested-with: rest' .... tracker/rest/data/status/1

it works and a subsequent GET on tracker/rest/data/status

will not show status10.

Using:

   curl -u admin:adminpw -X PATCH  \
      -H "x-requested-with: rest" \
      -H "Content-Type: application/json" \
      -H "Origin: https://hostname" \
      -H "Referer: https://hostname/tracker" \
      -H 'If-match: "0ad78b0fd17712641b65ca1f8a60f7a0"' \
      --data-binary '{ "@op": "action", "@action_name": "retire" }' \
     https://hostname/tracker/rest/data/status/10

returns:

  {
    "data": {
        "id": "10",
        "type": "status",
        "link": "https://hostname/tracker/rest/data/status/10",
        "result": null
    }
  }

should also work. Note that using this with a user missing the restire/restore permission in a role, I get a 403 error.

  {
    "error": {
        "status": 403,
        "msg": "You do not have permission to retire or restore the status class."
    }
  }

Does this describe what you are seeing?

--
                                -- rouilj John Rouillard ===========================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.