Hello team
Could someone help with any advice in regards to how we can retrieve the contacts of all users in thenew JSM OPS ?
We have migrated fromops genie to JSM and i am testing the APIS, and all i can get is the contacts of my user , so the user of the API key in use( i am org admin)
I am using the List contacts endpoint
GET
Returns the list of the contacts of a user.
read:ops-config:jira-service-managementinteger
integer
200OK
Returned if the request is successful.
401Unauthorized404Not Found422Unprocessable Entity
/ This code sample uses the 'node-fetch' library: // https://www.npmjs.com/package/node-fetch const fetch = require('node-fetch'); fetch('https://api.atlassian.com/jsm/ops/api/{cloudId}/v1/users/contacts', { method: 'GET', headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:<api_token>' ).toString('base64')}`, 'Accept': 'application/json' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err));{ "values": [ { "id": "299003c3-8221-4a9f-b63d-2370c4caaaaa", "method": "email", "to": "test@example.com", "status": { "enabled": true }, "applyOrder": 0 }, { "id": "735a619b-e420-4d46-ab5c-45523011aaaa", "method": "sms", "to": "90-555-555-5555", "status": { "enabled": true }, "applyOrder": 1 } ], "links": { "next": "url?offset=2&size=1", "last": "url?offset=2&size=1" } }
Is there a way to pass any user identifier and get this user's contacts???
The API documented here shows that there are three parameters (offset, size and targetAccountId. So use GET for the below endpoint
https://api.atlassian.com/jsm/ops/api/{cloudId}/v1/users/contacts?targetAccountId={accountId}
To retrieve all users’ contacts, you would need to first get the relevant Jira accountIds, then call this endpoint once per user. I could not see any API to retrieve all contacts in one single endpoint.
I hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.