Q: 4
DRAG DROP Drag and drop the expressions from below onto the code to implement error handling. Not all options are used.
Drag & Drop
Discussion
Target 1: if response == 201:, Target 2: else:. That's how RESTful error handling works for POST, since 201 means created. I think this is what Cisco wants here, matches HTTP status code best practice.
Target 1: if response == 201:, Target 2: else:. I don't think "if response == 601:" is right, 201 is the valid status code for success. Trap option with 601, seen this setup on exam reports.
Target 1: if response == 201:, Target 2: else:. Had something like this in a mock, fits the HTTP standard.
Target 1: if response == 201:, Target 2: else:. Standard HTTP codes apply, 201 for create success. I think that's correct here.
Cisco could make these drag and drops less confusing. Mapping is Target 1: if response == 201:, Target 2: else:.
Target 1: if response == 201:, Target 2: else:. That's the usual try for REST API error handling, 201 signals success and else picks up anything not matching. Seen similar in code labs so I think this matches what Cisco expects.
Target 1: if response == 201:, Target 2: else:. That's the common pattern for handling API responses, since 201 is success for creation and else catches the rest. Seen it on practice tasks, so I'm pretty sure this is the right way, but open to other takes.
Actually, Target 1 should map to if response == 201:, then Target 2 is else:. The question uses standard HTTP codes, so 601 is a bit of a trap here. Pretty sure this lines up with REST best practice but let me know if you spot something off.
Yeah, Target 1 should be if response == 201: and Target 2 is else:. That lines up with standard REST and HTTP conventions for a successful POST (201 means resource created). Pretty sure that's what Cisco expects here, but open if someone saw different API docs.
Target 1: if response == 601:, Target 2: elif:. Some APIs use their own codes, so this almost works.
Be respectful. No spam.
