New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

IBM C1000-138 Exam - Topic 3 Question 8 Discussion

Actual exam question for IBM's C1000-138 exam
Question #: 8
Topic #: 3
[All C1000-138 Questions]

What is correct about using context variables in Gatewayscript policies?

Show Suggested Answer Hide Answer
Suggested Answer: A

Setting Context Variables: In Gatewayscript policies, thecontext.setfunction is used to set context variables. The syntaxcontext.set('my.vars.amount', 100)creates a JSON structure wheremy.varsis an object containing the keyamountwith the value100.

JSON Structure: This method of setting context variables generates a JSON structure, which is a common format for data interchange in APIs. The resulting structure would be{ 'my.vars': { 'amount': 100 } }.

Usage in Policies: This approach allows for easy manipulation and access to variables within the GatewayScript, facilitating dynamic API behavior based on the context.

Documentation Reference: According to the IBM Certified Solution Implementer - API Connect v10.0.3 documentation, usingcontext.setin this manner is the correct way to generate the specified JSON structure1.

1:IBM Certified Solution Implementer - API Connect v10.0.3 Documentation


Contribute your Thoughts:

0/2000 characters
Lazaro
3 months ago
C is definitely right, I've used that before!
upvoted 0 times
...
Ammie
3 months ago
Wait, does D really update the request status?
upvoted 0 times
...
Kerry
3 months ago
B seems off, not all vars are in XML.
upvoted 0 times
...
Kenneth
4 months ago
Totally agree with A!
upvoted 0 times
...
Stevie
4 months ago
A is correct, it creates a nested object.
upvoted 0 times
...
Reena
4 months ago
I’m a bit confused about option D; I thought the request object status code was updated differently.
upvoted 0 times
...
Rebecka
4 months ago
I practiced a question similar to option C, and I believe it does update the message status code correctly.
upvoted 0 times
...
Lucille
4 months ago
I remember something about context variables being stored in a tree, but I can't recall if it's specifically XML.
upvoted 0 times
...
Mendy
5 months ago
I think option A sounds familiar, but I'm not entirely sure if it generates that exact structure.
upvoted 0 times
...
Hassie
5 months ago
Alright, let me think this through step-by-step. Option A sounds right, since that's the syntax for setting a context variable. For the other options, I'll need to carefully consider how the context variables interact with the different objects in Gatewayscript.
upvoted 0 times
...
Mira
5 months ago
I'm a bit confused by this question. The context variables in Gatewayscript can be a bit tricky to remember. I'll need to review the documentation to make sure I understand the differences between the request and message objects.
upvoted 0 times
...
Donette
5 months ago
I've worked with context variables before, so I'm pretty confident about this one. I'm pretty sure option C is correct, since that's how you'd update the status code of the message object.
upvoted 0 times
...
Daniel
5 months ago
Okay, let's see. I think option A is correct, since that's how you'd set a context variable. But I'm not sure about the other options - I'll have to double-check the details on those.
upvoted 0 times
...
Joseph
5 months ago
Hmm, this looks like a tricky one. I'll need to carefully read through the options and think about how context variables work in Gatewayscript policies.
upvoted 0 times
...
Karl
1 year ago
I always get these context variable questions mixed up. Maybe I should just start guessing randomly.
upvoted 0 times
Ludivina
1 year ago
B) All API context variables are saved in an XML tree.
upvoted 0 times
...
Lisbeth
1 year ago
C) context.message.statuscode = '200 Success' updates the status code of the message object.
upvoted 0 times
...
Earnestine
1 year ago
A) context.set('my.vars.amount', 100) generates { my.vars: { amount: 100 } }
upvoted 0 times
...
...
Berry
1 year ago
Wait, so we can't use context.request.statuscode? That's going to make my life a lot harder.
upvoted 0 times
Hubert
1 year ago
C) context.message.statuscode = '200 Success' updates the status code of the message object.
upvoted 0 times
...
Lavonna
1 year ago
B) All API context variables are saved in an XML tree.
upvoted 0 times
...
Erinn
1 year ago
A) context.set('my.vars.amount', 100) generates { \'my.vars\': { \'amount\': 100 } }
upvoted 0 times
...
...
Michel
1 year ago
Hmm, that makes sense. I see your point now.
upvoted 0 times
...
Ciara
1 year ago
I disagree, I believe C) is correct because it updates the status code of the message object.
upvoted 0 times
...
Michel
1 year ago
I think A) is correct because it shows how to set a context variable.
upvoted 0 times
...
Felicitas
1 year ago
This exam question is a piece of cake! I could answer it in my sleep.
upvoted 0 times
...
Bulah
1 year ago
Option D is incorrect. The context.request.statuscode property does not exist, it should be context.message.statuscode.
upvoted 0 times
Nickole
1 year ago
Option D is incorrect. The context.request.statuscode property does not exist, it should be context.message.statuscode.
upvoted 0 times
...
Carin
1 year ago
C) context.message.statuscode = '200 Success' updates the status code of the message object.
upvoted 0 times
...
Trevor
1 year ago
B) All API context variables are saved in an XML tree.
upvoted 0 times
...
Angelo
1 year ago
A) context.set('my.vars.amount', 100) generates { \'my.vars\': { \'amount\': 100 } }
upvoted 0 times
...
...
Merlyn
1 year ago
Option C is the correct answer. The context.message.statuscode property allows you to update the status code of the message object.
upvoted 0 times
Carlee
1 year ago
A) context.set('my.vars.amount', 100) generates { \'my.vars\': { \'amount\': 100 } }
upvoted 0 times
...
Brandon
1 year ago
C) context.message.statuscode = '200 Success' updates the status code of the message object.
upvoted 0 times
...
...
Kanisha
1 year ago
Option A is also correct. The context.set() function allows you to set context variables as key-value pairs.
upvoted 0 times
...

Save Cancel