I'm getting error 400 when trying to get property from request type.
Already tried to authenticate with an encodedBase64 user and password, but it didn't worked.
Code:
def username = "user"
def password = "token"
String credentials = username + ":" + password
def auth = "Basic " + credentials.bytes.encodeBase64().toString()
//String encoded = credentials.bytes.encodeBase64().toString()
def response = get("rest/servicedeskapi/servicedesk/99/requesttype/2141/property" + token_appender)
.header("cache-control", "no-cache")
.asObject(Map)
.body
//Import library clone attachments
import org.apache.http.entity.ContentType;
// Begin - Imports just to generate debud
import org.apache.log4j.Logger
import org.apache.log4j.Level
// End - Imports just to generate debud
// Only for test
def log = Logger.getLogger("com.acme.CreateSubtask")
log.setLevel(Level.DEBUG)
// Only for test
def issuekey = 'SDQ-1'
def result = get('/rest/api/2/issue/' + issuekey)
.header('Content-Type', 'application/json')
.asObject(Map)
def requestType = get ('/rest/servicedeskapi/request/'+ issuekey)
.header('Content-Type', 'application/json')
.asObject(Map)
def projectKey = result.body.fields.project.key
def requestTypeId = requestType.body.requestTypeId
def propertyKeyResult = get('rest/servicedeskapi/servicedesk/99/requesttype/2184/property')
.header('Content-Type', 'application/json')
.header('X-ExperimentalApi', 'opt-in')
.basicAuth('Authorization', auth )
.header("cache-control", "no-cache")
.asObject(Map)
.body
API documentation: https://developer.atlassian.com/cloud/jira/service-desk/rest/#api-rest-servicedeskapi-servicedesk-serviceDeskId-requesttype-requestTypeId-property-get
with Postman it works fine.
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.