Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
How to pass query parameters in rest api?

I have passed body parameters include method in single object to call api but iam unable to pass query parameters in the object.

code is

let fkPostPayload = {
        httpMethod: "POST",
        path: "/event",
        body: {
            "payload": {
                "application": {
                    "id": 11870117004,
                    "candidate": {
                        "id": 10921993004,
                        "first_name": "011200aaa0Test01FF",
                        "last_name": "01111200aa0Test01FF",
                        "title": null,
                        "is_private": true,
                        "can_email": true,
                        "external_id": null,
                        "phone_numbers": [],
                        "email_addresses": [
                            {
                                "value": "02000111aaa111Test01FF@test.com",
                                "type": "personal"
                            }
                        ],
                    },
                }
            }
        },
        queryParam:{ "clientId":70, "countryCode":"BRA","partner":"AA-GMS" }
    }

i have passed the payload in api call, able to get body parameters value but unable to get queryparam values. suggest the better solution.

when i tried to get query params value using req.query its return empty object.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Try to pass parameters in the path

import map from 'lodash/map'

const httpBuildQuery = function (url, queryParams) {
  const queryString = map(
    queryParams,
    function (val, key) {
      return encodeURIComponent(key) + '=' + encodeURIComponent(val)
    }
  ).join('&')

  if (queryString) {
    const separator = !url.includes('?')
      ? '?'
      : '&'

    return url + separator + queryString
  } else {
    return url
  }
}

let fkPostPayload = {
  httpMethod: "POST",
  path: httpBuildQuery("/event", { "clientId":70, "countryCode":"BRA","partner":"AA-GMS" }),
  body: {
      "payload": {
          "application": {
              "id": 11870117004,
              "candidate": {
                  "id": 10921993004,
                  "first_name": "011200aaa0Test01FF",
                  "last_name": "01111200aa0Test01FF",
                  "title": null,
                  "is_private": true,
                  "can_email": true,
                  "external_id": null,
                  "phone_numbers": [],
                  "email_addresses": [
                      {
                          "value": "02000111aaa111Test01FF@test.com",
                          "type": "personal"
                      }
                  ],
              },
          }
      }
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

otherwise simply we can pass using

queryStringParameters:{clientId:"70"}

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda