Method configuration

When defining a path, you must add one or more methods. The New method panel includes the following options:


New method panel

  • Type: Click one or more HTTP methods that the path supports.
  • Description: This description displays in DeveloperHub to help consumers understand the purpose of the method.
  • Tags: Optional.
  • Request body: Only available for PUT, PATCH, and POST methods. Options include:

    New request body

    • Media type: The required format for the request. For example, application/json or application/xml.
    • Example: Illustrates a sample request to help consumers call the endpoint successfully. For example:
      {
        "name": "John Doe",
        "email": "john@example.com"
      }
                
    • Schema: A JSON Schema, or subset, that defines the expected format of the payload. For example:
      {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          }
        },
        "required": ["name", "email"]
      }
      
                    
                  
  • Parameters: Parameters are typically used to identify a resource while the request body provides content for that resource. For example, the Pet Store has an endpoint to find a pet by ID. An integer petId is a required request path parameter. Parameter configuration describes parameter options.
  • Responses: Defines what can be returned to the caller:

    New response panel

    • Code: One or more HTTP status codes that the endpoint can return. For example, the Pet Store endpoint to get a pet by its ID returns 200 for success, 400 for an invalid ID, and 404 for a pet not found.
    • Description: The user-friendly message for the code. For example, User created successfully
    • Response: Optional content that the server returns.
      • Media type: The required format for the request. For example, application/json or application/xml.
      • Example: Sample responses for success and error conditions. For example:
        { ...
          "example": {
             "error": "User not found"
           }
         }
      • Schema: The response schema. For example:
        {
          "type": "object",
          "properties": {
            "error": {
              "type": "string"
            }
          },
          "required": ["error"]
        }

Add the appropriate rules to the Catalog Policy or apply a Policy at the Service or endpoint level, and you are ready to test.