Vishalt winjit
Vishalt winjit

Reputation: 35

Swagger : Get method using body is not working also changed into the query, path, header still not working

i am making openapi.yaml till now as well as deploying my test API's on the google cloud endpoints is working but now i made some changes i am sending parameter in body to the get api (e.g email) and getting some response but actually on the local it is working fine with postman after deploying openapi.yaml file it is not working on the google cloud endponits portal

So, anybody has any solution or answers for this so please help me

For safety i am also sharing error screenshot also y code snippet

"/api/getRecords":
   get:
    description: "Get All Records Details."
    operationId: "getRecords"
    produces:
      - "application/json"    
    parameters:
    - description: "Message to getRecords"
      in: query
      name: getRecords
      type: object
      required: false
      schema:
        $ref: "#/definitions/echoMessage"         
    responses:
      200:

Also,

enter image description here

Upvotes: 1

Views: 5176

Answers (1)

Shivalika Gupta
Shivalika Gupta

Reputation: 86

Try your code like this :

# [START swagger]
  swagger: "2.0"
  info:
    description: "A simple Google Cloud Endpoints API example."
    title: "Endpoints Example"
    version: "1.0.0"
  host: "abc.appspot.com"
# [END swagger]
  parameters:
    email:
      name: email
      in: query
      type: string
      required: true

Then use shorthand syntax in the path:

path:
 "/api/getRecords":
   get:
     description: "Get All Records Details."
     operationId: "getRecords"
     parameters:
       - $ref: "#/parameters/email"
     responses:
       200:
         description: "Get records details"
         schema:
           $ref: "#/definitions/postMessage"

It will work.

Upvotes: 1

Related Questions