I'm trying to modify my first field by REST API with Excel VB. And cannot seem to do it right. I keep getting this error: "". : responseText : "{"errorMessages":[],"errors":{"description":"Operation value must be an Atlassian Document (see the Atlassian Document Format)"}}".
This is what I do:
With JiraService
.Open "PUT", "https://example.atlassian.net/rest/api/3/issue/RZ-83", false
.SetRequestHeader "Content-Type", "application/json"
' .SetRequestHeader "Accept", "application/json"
.SetRequestHeader "Authorization", "Basic " & UserPassBase64
.Send sData
If .Status <> "200" Then
MsgBox "Error getting JIRA data"
…
sData is a String, taken from a cell:
{ "fields": { "description": {"name": "Inverter SWA5D mockup"} } }
I tried the same API with curl. Same result.
07/05/2020 16:04.33 /drives/d/work/ZOE curl -D- -v -u <removed> -X PUT --data @data.txt -H "Content-Type: application/json" https://example.atlassian.net/rest/api/3/issue/RZ-83 * Trying 18.184.99.129:443... * TCP_NODELAY set * Connected to <removed>.atlassian.net (<removed>) port 443 (#0) * ALPN, offering http/1.1 * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * TLSv1.2 (OUT), TLS header, Certificate Status (22): * TLSv1.2 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (IN), TLS handshake, Server key exchange (12): * TLSv1.2 (IN), TLS handshake, Server finished (14): * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.2 (OUT), TLS handshake, Finished (20): * TLSv1.2 (IN), TLS change cipher, Change cipher spec (1): * TLSv1.2 (IN), TLS handshake, Finished (20): * SSL connection using TLSv1.2 / <removed> * ALPN, server accepted to use http/1.1 * Server certificate: * subject: C=US; ST=California; L=San Francisco; O=Atlassian Network Services, Inc.; CN=*.atlassian.net * start date: Nov 28 00:00:00 2019 GMT * expire date: Jan 18 12:00:00 2022 GMT * subjectAltName: host "<removed>.atlassian.net" matched cert's "*.atlassian.net" * issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA * SSL certificate verify ok. * Server auth using Basic with user '<removed>' > PUT /rest/api/3/issue/RZ-83 HTTP/1.1 > Host: <removed>.atlassian.net > Authorization: Basic <removed> > User-Agent: curl/7.65.0 > Accept: */* > Content-Type: application/json > Content-Length: 66 > * upload completely sent off: 66 out of 66 bytes * Mark bundle as not supporting multiuse < HTTP/1.1 400 HTTP/1.1 400 < Server: AtlassianProxy/1.15.8.1 Server: AtlassianProxy/1.15.8.1 < Cache-Control: no-cache, no-store, no-transform Cache-Control: no-cache, no-store, no-transform < Content-Type: application/json;charset=UTF-8 Content-Type: application/json;charset=UTF-8 < Strict-Transport-Security: max-age=315360000; includeSubDomains; preload Strict-Transport-Security: max-age=315360000; includeSubDomains; preload < Date: Thu, 07 May 2020 13:06:52 GMT Date: Thu, 07 May 2020 13:06:52 GMT < ATL-TraceId: f3dcd6eff612c2fb ATL-TraceId: f3dcd6eff612c2fb < X-AREQUESTID: f943bf21-6e00-4c64-b5ed-987d3881753b X-AREQUESTID: f943bf21-6e00-4c64-b5ed-987d3881753b < X-AACCOUNTID: 5c656d71cefe97640e69aed3 X-AACCOUNTID: 5c656d71cefe97640e69aed3 < X-XSS-Protection: 1; mode=block X-XSS-Protection: 1; mode=block < Transfer-Encoding: chunked Transfer-Encoding: chunked < Timing-Allow-Origin: * Timing-Allow-Origin: * < X-Content-Type-Options: nosniff X-Content-Type-Options: nosniff < Micros-Issuer: micros/edge-authenticator Micros-Issuer: micros/edge-authenticator < Connection: close Connection: close < Set-Cookie: atlassian.xsrf.token=313e6096-54ac-4d91-a48f-304612fe7819_776bfecf67a1773822c4defb8e1685b5f34245f9_lin; Path=/; Secure Set-Cookie: atlassian.xsrf.token=313e6096-54ac-4d91-a48f-304612fe7819_776bfecf67a1773822c4defb8e1685b5f34245f9_lin; Path=/; Secure < Expect-CT: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/global-proxy", enforce, max-age=86400 Expect-CT: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/global-proxy", enforce, max-age=86400 < * Closing connection 0 * TLSv1.2 (OUT), TLS alert, close notify (256): {"errorMessages":["We couldn't save your changes. Copy your content, then try reloading the page."],"errors":{}}
Hello @Alexandru Muntean ,
My Apologies on the delayed reply, But looking at this, the formatting for Description is going to be a bit different as the field accepts a rich text formatting and the field uses the Atlassian Document Format (ADF) and you will want to refer to the "Atlassian Document Format" documentation for example syntax on fields that require this, but updating the Data package to the following should do the trick to be able to modify the description:
{
"fields": {
"description": {
"version": 1,
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Inverter SWA5D mockup"
}
]
}
]
}
}
}
Regards,
Earl
Hello @Alexandru Muntean ,
I'm taking a look at your request but just a heads up I noticed that your API token was in plain text in the CURL output you posted, I edited the post to remove the sensitive content, But I highly recomend for security reasons revoking the API token and creating a new one as this is a publicly visible forum.
Details on creating the api token can be seen here and revoking a token is done from the same location:
Again I'll take a look at the API call and get back to you shortly
Regards,
Earl
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.