nerdexam
Cisco

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…

Cisco Intersight

Question

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". Using the Cisco Intersight REST API in a Python script, which two GET API requests are used to retrieve just the server profile with the string "WEST15" in the name and the correct body for the API request to update the name? Assume the variable "sp_name" contains the name of the retrieved server profile. (Choose two.)

Options

How the community answered

(28 responses)
  • A
    7% (2)
  • B
    75% (21)
  • C
    14% (4)
  • D
    4% (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

#REST API#OData filtering#Python string methods#Cisco Intersight

Community Discussion

No community discussion yet for this question.

Full 300-635 Practice