raiseOnBehalfOf when creating a comment

I’m developing an external app that gives an opportunity for users in my app to create requests in JSD Cloud. I use basic auth. I don’t really need OAuth because users don’t interact with JSD Cloud explicitly. The requests from my user go to my server and then using basic auth I make actions using only one superuser in JSD Cloud though API.

I already can create customers and requests using their names by using /rest/servicedeskapi/request with raiseOnBehalfOf.

I’m trying to make the same for comments /rest/servicedeskapi/request/#{request_key}/comment but there is no raiseOnBehalfOf.

I found this question. The staff suggests to use this endpoint. There is a body parameter called author that is UserJsonBean. When I set it nothing changes and newly created comment is created by the user that uses API (not that I want).

How can I add a comment to a known request by an exact user?

1 Like

At 2018-06-01 I asked this question at Atlassian Ecosystem and just got the answer:

Thanks for taking the time to raise this issue. We currently have no SLA for this type of request.

I’d suggest posting this question in the developer community where Atlassian and Marketplace vendors collaborate. This portal is for raising bugs/suggestions, support request requiring confidential information, cloud/server API gaps, and GDPR questions. More importantly, posting this in the community will provide an available thread to other developers seeking the same answer.

Regarding linked community post, I was the one who suggested that REST endpoint. It’s meant to be used in basic auth.

Hi @evmorov,

Just to give more context on our drive to post in the developer community - we wanted our answers to be accessible to all developers. More importantly, if it would benefit them. But apologies if I have not gotten back to this or any of our team, but rest assured that we don’t mean to not answer any of your posts.

You may be interested on voting and watching for this feature request.

As for adding a comment with an author via REST API, can you share with us the exact request that you used so I may test on my end? Please replace any username and password. If this is indeed an issue, we can file a bug for this.

Cheers,
Anne Calantog

Wow. Quite popular feature request.

Here it is:

curl --request POST \
  --user {superuser_email:token} \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '
    {
      "body": "Hello world!",
      "author": {
        "key": "{key_of_a_customer}"
      },
      "updateAuthor": {
        "key": "{key_of_a_customer}"
      }
    }' \
  --url '{my_url}/rest/api/2/issue/{issue_key}/comment'
curl --request POST \
  --user {superuser_email:token} \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '
    {
      "body": "Hello world!",
      "author": {
        "emailAddress": "{email_of_a_customer}"
      },
      "updateAuthor": {
        "emailAddress": "{email_of_a_customer}"
      }
    }' \
  --url '{my_url}/rest/api/2/issue/{issue_key}/comment'

Both of them have no affect. Comments are created not from a customer but from the superuser that sends the requests.

Looks like a bug. Where can I file a bug?

Hi @evmorov,

You may file product, framework, bugs and feature requests at Developer Support portal .

Cheers,
Anne Calantog

But am I using UserJsonBean in the right way?

Still waiting for reply.

Hi @evmorov,

Sorry I missed this. Your UserJsonBean seems to conform with the schema:

{
  "properties": {
    "accountId": {
      "type": "string"
    },
    "active": {
      "type": "boolean"
    },
    "avatarUrls": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object"
    },
    "displayName": {
      "type": "string"
    },
    "emailAddress": {
      "type": "string"
    },
    "key": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "self": {
      "type": "string"
    },
    "timeZone": {
      "type": "string"
    }
  },
  "type": "object"
}

Cheers,
Anne Calantog