Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Getting the post methods
posted

Hi There,

In the app builder, I set up a connection to my webapi but it only shows the checkboxes for GET Methods not POST Methods.

What am I missing?

Thanks for any help.

Best Regards,

Steve.

  • 1560
    Offline posted

    Hello,

    I have been looking into your question and what I can say is that currently, AppBuilder only supports endpoints returning array or object. Endpoints that are described to return primitive types (or are lacking description of the return type) are being greyed out.

    You can check the definition file, search for the endpoints, and see what is their description of the `response` object. If it is missing, you may try adding a response object:

    ```
    "responses": {
      "200": {
        "description": "Success",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Employee"
              }
            }
          }
        }
      }
    }
    ```
    "$ref": "#/components/schemas/Employee" should point to an entry within the components property:

     

    ```
    components: {
    schemas: {
    Employee: {
    type: "object",
    properties: {
    id: {
    type: "string",
    format: "uuid"
    },
    name: {
    type: "string",
    nullable: true
    },
    email: {
    type: "string",
    nullable: true
    },
    phone: {
    type: "integer",
    format: "int64"
    }
    },
    additionalProperties: false
    }
    ```

    Please keep in mind that these are only examples and you need to check your OpenAPi definition file, and try to fix it.

    If the issue is still reproducible, please send your source, so we could investigate this further.

    Looking forward to hearing from you.


    Sincerely,
    Teodosia Hristodorova
    Software Developer

  • 1560
    Offline posted in reply to Steve Wilson

    Hello,

    After an investigation, I have found a forum thread where similar issue has been discussed:

    AppBuilder: When adding REST-api the endpoints are disabled and not selectable | Infragistics Forums

    As it is mentioned there, Results.Ok() is an old method and loses all the type information that Swagger (OpenAPI) needs to produce the correct metadata and App Builder to be able to "see" the return types.

    So you need to use either:

    - Return Task<YourResponseType>, where OK is assumed.
    - Return TypedResult.Ok(yourResponse), where OK is explicit.

    If you require any further assistance on the matter, please let me know.


    Sincerely,
    Teodosia Hristodorova
    Software Developer