I am using ScriptRunner to try to manipulate Asset objects. I want to get the list of Attributes defined in my schema. When I run the following code, I get back the Scheme information:
get("${base()}/objectschema/2")
.header('Authorization',auth())
.header('Content-Type', 'application/json')
.asObject(Map)
This results in (identifiers are removed intentionally)
{ "workspaceId": "******", "globalId": "*****:2", "id": "2", "name": "****", "objectSchemaKey": "****", "status": "Ok", "description": "", "created": "2023-10-18T19:54:31.806Z", "updated": "2023-10-18T19:54:31.808Z", "objectCount": 5911, "objectTypeCount": 8, "canManage": false, "idAsInt": 2 }
Adding "attributes" to the end of the call as such return a null body
get("${base()}/objectschema/2/attributes")
.header('Authorization',auth())
.header('Content-Type', 'application/json')
.asObject(Map)
What am I doing wrong?
Hi @Derek Fields _RightStar_ ,thanks for your question.
Can you try this please,
get("${base()}/objectschema/2/attributes")
.header('Authorization',auth())
.header('Content-Type', 'application/json')
.asObject(List)
.body
Best,
Murat Seven
That did the trick. I am confused about when to use asObject(Map) version asObject(List). The return value without ".body" looks like a Map to me.
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.