300-635 · Question #34
A server profile with the string "WEST15" in its name must have the string "WEST15" changed to "LXT14". For example, server profile "VMHOST-WEST15-01" would need to be changed to "VMHOST-LXT14-01"…
The correct answer is B. GET https://intersight.com/api/v1/server/Profiles?$select=Name&$filter=Name in('WEST15') E. BODY = {"Name": sp_name.replace('WEST15','LXT14')}. Note: There appears to be an error in the stated correct answers - the logical correct pair is A and E, not B and E. Here's the accurate explanation: Option A is the correct GET request because the OData contains() function filters for any profile whose name includes the…
Question
Options
- AGET https://intersight.com/api/v1/server/Profiles?$select=Name&$filter=contains(Name,'WEST15')
- BGET https://intersight.com/api/v1/server/Profiles?$select=Name&$filter=Name in('WEST15')
- CBODY = {"Name": sp_name.format('WEST15', 'LXT14')}
- DGET https://intersight.com/api/v1/server/Profiles?$select=Name&$filter=startswith(Name,'WEST15')
- EBODY = {"Name": sp_name.replace('WEST15','LXT14')}
How the community answered
(28 responses)- A7% (2)
- B75% (21)
- C14% (4)
- D4% (1)
Explanation
Note: There appears to be an error in the stated correct answers - the logical correct pair is A and E, not B and E. Here's the accurate explanation:
Option A is the correct GET request because the OData contains() function filters for any profile whose name includes the substring "WEST15" anywhere (e.g., VMHOST-WEST15-01). Option B is incorrect because Name in('WEST15') uses the OData in operator, which checks for an exact match - it would only return a profile named literally "WEST15", never "VMHOST-WEST15-01".
Option E is the correct BODY because Python's str.replace('WEST15', 'LXT14') substitutes the target substring wherever it appears, yielding {"Name": "VMHOST-LXT14-01"}. Option C is wrong because .format('WEST15', 'LXT14') requires {} positional placeholders in the string - sp_name contains no such placeholders, so it would fail or return the name unchanged.
Option D is wrong because startswith(Name,'WEST15') only matches profiles whose name begins with "WEST15" - it would miss "VMHOST-WEST15-01" entirely.
Memory tip: Think "contains = substring anywhere" vs "in = exact set membership" - for OData filters, always match the operator's scope to your actual search need. And for Python string replacement, .replace() is the direct swap; .format() fills holes ({}), not named strings.
Bottom line: If this question appears on your exam, the defensible answers are A and E. The stated answer of B is likely a typo or keying error - flag it if you can.
Topics
Community Discussion
No community discussion yet for this question.