How set inputs on rest service get?

What product/components do you use and which version/fix level?

IS 10.5

What are trying to achieve? Please describe in detail.

I have a flow service named sumar
image
Input/Output

I have a Rest resource

And it descriptor


Swagger:

---
swagger: "2.0"
info:
  description: "API de una calculadora"
  version: "1.0"
  title: "calculadora"
host: "127.0.0.1:5555"
basePath: "/rad/Pruebas.api:calculadoraDescriptor"
schemes:
- "http"
consumes:
- "application/json"
produces:
- "application/json"
paths:
  /sumar:
    get:
      description: ""
      operationId: "sumar_GET_1"
      parameters:
      - in: "body"
        name: "request"
        description: ""
        required: true
        schema:
          $ref: "#/definitions/request"
      responses:
        200:
          description: "OK"
          schema:
            $ref: "#/definitions/sumar_GET_response"
        401:
          description: "Access Denied"
definitions:
  response:
    required:
    - "resultado"
    properties:
      resultado:
        type: "string"
  sumar_GET_response:
    required:
    - "response"
    properties:
      response:
        $ref: "#/definitions/response"
  request:
    required:
    - "num1"
    - "num2"
    properties:
      num1:
        type: "string"
      num2:
        type: "string"

When I execute in postman this response null

Ive tried with savePipeline and restorePipeline and can not see my variables request/num1 and request/num2

What’s wrong?

Regards,
Jesus

GET normally does not have a body. Various components may ignore a body when present.

But in case that’s not happening here, the expected input document is named “request”. Your Postman body does not have that. Instead, it has an anonymous object with 2 string fields. Adjust that and it may work.

Thank you for your reply.

Ive adjust the body with request object and not working yet.

Can you tell me more, please?

As @reamon indicated you can’t post a body with GET.
If you want to use GET provide the two inputs via query params
e.g.
/sumar?num1=1&num2=99

Then update your service to remove ‘request’ document wrapper and simply have num1 and num2 as your inputs to your service.

If you want to use a body, you will have to provide a POST based API.
regards
John.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.