Forum Discussion

AlliBear's avatar
AlliBear
New Member
4 months ago

YAML - Not being read by Insomnia to create a get bearer token method completely

Having trouble writing a YAML that is read by Insomnia to create the get bearer token request method correctly:
Here is the part of the YAML that should be read by Insominia to create the request method correctly: 
paths:
  /pathtotoken/gettoken:
    post:
      tags:
        - token
      description: GetToken
      operationId: GetToken
      requestBody:
        description: Get bearer token
        required: true
        content:
           application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
               thegrantypepropname:
                type: string
                default: thegranttypepropertyvalue
               theclientidpropname:
                type: string
                default: theclientidpropvalue
               theclientsecretpropname:
                type: string
                default: theclientsecretpropvalue

When I generate the request collection in Insomnia, the get bearer token method is generated BUT the key-value pairs for the properties are missing in the FORM.

1 Reply

  • ros686285's avatar
    ros686285
    New Contributor

    Based on the provided YAML snippet, it looks like you're defining a POST request to the /pathtotoken/gettoken endpoint with a request body in application/x-www-form-urlencoded format.

    Here's the corrected YAML snippet for Insomnia:

    openapi: "3.0.0" info: title: "API" version: "1.0.0" paths: /pathtotoken/gettoken: post: tags: - token description: GetToken operationId: GetToken requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object properties: thegrantypepropname: type: string default: thegranttypepropertyvalue theclientidpropname: type: string default: theclientidpropvalue theclientsecretpropname: type: string default: theclientsecretpropvalue

    Make sure to use the correct YAML indentation and structure to accurately describe the request body parameters. Once you import this YAML into Insomnia, it should correctly generate the request method with the specified key-value pairs for the properties in the form data.