BlackFriday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

IBM Exam C1000-138 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:

Karl
29 days ago
I always get these context variable questions mixed up. Maybe I should just start guessing randomly.
upvoted 0 times
Earnestine
15 days ago
A) context.set('my.vars.amount', 100) generates { my.vars: { amount: 100 } }
upvoted 0 times
...
...
Berry
30 days ago
Wait, so we can't use context.request.statuscode? That's going to make my life a lot harder.
upvoted 0 times
Hubert
2 days ago
C) context.message.statuscode = '200 Success' updates the status code of the message object.
upvoted 0 times
...
Lavonna
10 days ago
B) All API context variables are saved in an XML tree.
upvoted 0 times
...
Erinn
16 days ago
A) context.set('my.vars.amount', 100) generates { \'my.vars\': { \'amount\': 100 } }
upvoted 0 times
...
...
Michel
1 months ago
Hmm, that makes sense. I see your point now.
upvoted 0 times
...
Ciara
1 months ago
I disagree, I believe C) is correct because it updates the status code of the message object.
upvoted 0 times
...
Michel
1 months ago
I think A) is correct because it shows how to set a context variable.
upvoted 0 times
...
Felicitas
2 months ago
This exam question is a piece of cake! I could answer it in my sleep.
upvoted 0 times
...
Bulah
2 months ago
Option D is incorrect. The context.request.statuscode property does not exist, it should be context.message.statuscode.
upvoted 0 times
Nickole
24 days ago
Option D is incorrect. The context.request.statuscode property does not exist, it should be context.message.statuscode.
upvoted 0 times
...
Carin
1 months ago
C) context.message.statuscode = '200 Success' updates the status code of the message object.
upvoted 0 times
...
Trevor
1 months ago
B) All API context variables are saved in an XML tree.
upvoted 0 times
...
Angelo
1 months ago
A) context.set('my.vars.amount', 100) generates { \'my.vars\': { \'amount\': 100 } }
upvoted 0 times
...
...
Merlyn
2 months 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 months ago
A) context.set('my.vars.amount', 100) generates { \'my.vars\': { \'amount\': 100 } }
upvoted 0 times
...
Brandon
2 months ago
C) context.message.statuscode = '200 Success' updates the status code of the message object.
upvoted 0 times
...
...
Kanisha
2 months 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