You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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 @C_ Derek Fields ,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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.