/
Use JEMH Public Rest API to Export, Import and Update profiles

Use JEMH Public Rest API to Export, Import and Update profiles

The Atlassian REST API Browser | Atlassian Marketplace (currently Server only) is usable with JEMH.

JEMH has a lot of internal application REST services that are not recommended for use, we have a /public/ api section that is for external integration by REST:

Examples

atl_token is required on most calls, see most logged in pages for atlassian_token in html.

Listing profiles

prior to 3.3.36, the Profile needed to be edited and the API box checked for a profile to appear in this list, we’re relaxing that and applying specifically to the API for posting mail through a given profile.

curl -v -X GET -H "X-Atlassian-Token: no-check" --user admin:admin http://localhost:8080/rest/jemh/1.0/public/profile/list

results in:

[{"id":4,"name":"UPDATED VIA REST","desc":""}]

Export profile

curl -H "X-Atlassian-Token: no-check" --user admin:admin http://localhost:8080/rest/jemh/1.0/public/profile/export?profileId=4

Reponse is profile XML/

Update a profile

downloading a Profile XML and updating the Profile Name to “UPDATED VIA REST”:

andy@ppl14:~/Downloads$ curl -v -X POST -F "profileXml=@jemh-profile-TEST-DEVELOPMENT-rev1.xml" -H "X-Atlassian-Token: no-check" --user admin:admin http://localhost:8080/rest/jemh/1.0/public/profile/update?profileId=4 * Trying 127.0.0.1:8080... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8080 (#0) * Server auth using Basic with user 'admin' > POST /rest/jemh/1.0/public/profile/update?profileId=4 HTTP/1.1 > Host: localhost:8080 > Authorization: Basic YWRtaW46YWRtaW4= > User-Agent: curl/7.68.0 > Accept: */* > X-Atlassian-Token: no-check > Content-Length: 11143 > Content-Type: multipart/form-data; boundary=------------------------db971da8ff166d6d > Expect: 100-continue > * Mark bundle as not supporting multiuse < HTTP/1.1 100 * We are completely uploaded and fine * Mark bundle as not supporting multiuse < HTTP/1.1 200 < X-AREQUESTID: 713x899x1 < Referrer-Policy: strict-origin-when-cross-origin < X-XSS-Protection: 1; mode=block < X-Content-Type-Options: nosniff < X-Frame-Options: SAMEORIGIN < Content-Security-Policy: sandbox < Strict-Transport-Security: max-age=31536000 < Set-Cookie: JSESSIONID=8E97333EA311F2BD2A63DD24C7FF1021; Path=/; HttpOnly < X-Seraph-LoginReason: OK < Set-Cookie: atlassian.xsrf.token=BT07-EOS3-O16U-0NUH_6a28e7f5a00d826e11ef532debab3448f0a79c81_lin; Path=/ < X-ASESSIONID: 101m16a < X-AUSERNAME: admin < Cache-Control: no-cache, no-store, no-transform < Content-Type: application/xml;charset=UTF-8 < Content-Length: 148 < Date: Wed, 14 Jul 2021 10:53:39 GMT < * Connection #0 to host localhost left intact <?xml version="1.0" encoding="UTF-8" standalone="yes"?><FormMessage><message>Profile update successfully</message><type>SUCCESS</type></FormMessage>[1]+ Done

Profile after update shows the name change

Auditing > Profile Auditing shows delta:

 

Related content