Huawei OPS Connection Class HTTP Method Mapping Errors

H12-891 By islever Editorial Last updated

OPS Fundamentals and Practice

Short answer

AD Both A and D are incorrect because create() should use POST instead of PUT, and set() should use PUT instead of POST.

Question

Huawei Open Programmability System (OPS) uses HTTP methods to access managed objects to manage network devices. To facilitate script compilation, Huawei OPS provides the Python script template. Which of the following methods of the OPSConnection class in the OPS script template are incorrect?
  1. [image: https://img.examtopics.com/h12-891/image7.png] Correct Answer
  2. [image: https://img.examtopics.com/h12-891/image8.png]
  3. [image: https://img.examtopics.com/h12-891/image9.png]
  4. [image: https://img.examtopics.com/h12-891/image10.png] Correct Answer

Key Takeaways

The main trap is confusing HTTP POST (for creation) with PUT (for modification). Remember: Create=POST, Update=PUT, Read=GET, Delete=DELETE.

Identify incorrect HTTP method mappings in Huawei OPSConnection class. Correct answers are A and D, as create() needs POST and set() needs PUT.

Common mistake: Choosing only one option (A or D) is common, but both A and D represent incorrect mappings according to REST standards and Huawei's template.

Expert Analysis

The question asks to identify the incorrect HTTP method mappings in the Huawei OPSConnection class script template. This requires knowledge of standard RESTful API conventions and how Huawei's OPS implementation aligns with them.

In RESTful design:

  • GET is used to retrieve data (Read).
  • POST is typically used to create new resources (Create).
  • PUT is used to update or modify existing resources (Update/Set).
  • DELETE is used to remove resources (Delete).

Analyzing the options based on community feedback and standard practices:

  1. Option A (create uses PUT): This is incorrect. Creating a resource should use POST. Using PUT for creation is non-standard and often implies an idempotent upsert, but in the context of simple CRUD templates, create maps to POST. The comment explicitly states: "A — create uses 'PUT' → incorrect. Creating a resource should use POST."
  2. Option B (delete uses DELETE): This is correct. Deleting a resource uses the DELETE method.
  3. Option C (get uses GET): This is correct. Retrieving a resource uses the GET method.
  4. Option D (set uses POST): This is incorrect. Modifying or setting a resource configuration should use PUT. POST is for creation. The comment states: "D — set uses 'POST' → incorrect. Modifying/setting a resource should use PUT."

Therefore, both A and D contain incorrect method mappings. The question asks for the incorrect methods, so both A and D are valid answers.

This topic covers the integration of Python scripts with network devices via REST APIs, a key aspect of network automation. Understanding the semantic difference between POST (create) and PUT (update) is critical for writing functional automation scripts. Getting this wrong leads to operational errors where scripts fail to create objects or incorrectly overwrite existing configurations.

Exam Strategy

When dealing with REST API questions in certification exams, always revert to standard HTTP semantics: POST for creating, PUT for updating, GET for reading, DELETE for removing. If a question asks for 'incorrect' mappings, check every option against these four pillars. Do not assume 'set' means 'create'; 'set' implies modifying an existing state, which is a PUT operation.

Frequently Asked Questions

Why does create() use POST and not PUT?

In RESTful APIs, POST is used to send data to a server to create a new resource. PUT is generally used to replace an existing resource at a specific URI. Since creation generates a new ID, POST is the standard.

What is the difference between POST and PUT in Huawei OPS?

Use POST for creating new managed objects (like adding a new user or interface configuration). Use PUT for modifying existing objects (like changing an IP address or enabling/disabling a feature).

More H12-891 FAQ →

Community Votes

A
100%

100% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 3 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 3

  1. 0d3d98b 👍 4
    Should be AD According Examples 'Create' uses 'POST', and 'Modify' uses 'PUT'
  2. 6702b63 👍 2
    like Question #82 A and D
  3. megamind23 👍 1 Answered A
    Sould be AD A — create() uses "PUT" → incorrect. Creating a resource should use POST. B — delete() uses "DELETE" → correct. C — get() uses "GET" → correct. D — set() uses "POST" → incorrect. Modifying/setting a resource should use PUT

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

← Back to H12-891 Study Guide