exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 6 question 18 discussion

Actual exam question from Microsoft's AZ-204
Question #: 18
Topic #: 6
[All AZ-204 Questions]

DRAG DROP -
You are developing a REST web service. Customers will access the service by using an Azure API Management instance.
The web service does not correctly handle conflicts. Instead of returning an HTTP status code of 409, the service returns a status code of 500. The body of the status message contains only the word conflict.
You need to ensure that conflicts produce the correct response.
How should you complete the policy? To answer, drag the appropriate code segments to the correct locations. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
NOTE: Each correct selection is worth one point.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: on-error -
Policies in Azure API Management are divided into inbound, backend, outbound, and on-error.
If there is no on-error section, callers will receive 400 or 500 HTTP response messages if an error condition occurs.

Box 2: context -

Box 3: context -

Box 4: set-status -
The return-response policy aborts pipeline execution and returns either a default or custom response to the caller. Default response is 200 OK with no body.
Custom response can be specified via a context variable or policy statements.
Syntax:
<return-response response-variable-name="existing context variable">
<set-header/>
<set-body/>
<set-status/>
</return-response>

Box 5: on-error -
Reference:
https://docs.microsoft.com/en-us/azure/api-management/api-management-error-handling-policies https://docs.microsoft.com/en-us/azure/api-management/api-management-transformation-policies

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
jokergester
Highly Voted 3 years, 7 months ago
Just want to add that "set-status" also has code and reason (e.g. set-status code="409" reason="Conflict"). https://docs.microsoft.com/en-us/azure/api-management/api-management-advanced-policies#SetStatus
upvoted 44 times
SnakePlissken
3 years, 5 months ago
Thanks. set-status on it's own seemed a bit strange. Minor detail: Last on-error must be preceded by a slash.
upvoted 9 times
...
...
armoniyem
Highly Voted 3 years ago
THE ANSWER IS CORRECT.
upvoted 17 times
...
Maskoo
Most Recent 9 months, 1 week ago
Given answer is correct But tbh as a developer in this situation I would fix the API to return a 409 in case of conflicts instead of tweaking it using a Azure Policy...
upvoted 3 times
...
jaf19f
1 year, 2 months ago
I got this question (12-Aug-2023) and I chose the given answers - 932 passed
upvoted 4 times
...
BaoNguyen2411
1 year, 3 months ago
got this question on 29/06/2023
upvoted 4 times
...
AbidooKing
1 year, 3 months ago
Got this 2023July13. Went with given and scored 917.
upvoted 4 times
...
JH81
1 year, 4 months ago
I got this on 6/29/2023 and passed with 850. Answer is correct.
upvoted 3 times
...
Indhumathi_Saravanan
1 year, 7 months ago
Question was on 19-MAR-2023 exam
upvoted 3 times
...
seila1331
1 year, 11 months ago
Did my exam on 8/12/2022. This question was on it.
upvoted 5 times
...
TheExamMaster2020
1 year, 11 months ago
Did my exam on 15th November 2022. This question was on it.
upvoted 3 times
...
at_sayali
1 year, 11 months ago
Got this in 11/2022 Went with on-error, context, context, set-status, override-status, on-error One more blank space after <otherwise />, I selected override-status
upvoted 5 times
Ciupaz
9 months, 3 weeks ago
Override-status where?
upvoted 1 times
...
...
elequiel
2 years ago
Got it in exam 20/10/2022
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago