How can I add request header parameters in HTTP integration WebSocket api gateway AWS

0

I'm new to AWS. I want to add header parameters to my HTTP request. I tried the below command in CloudShell but it was not working.

aws apigatewayv2 update-integration --integration-id xxxxx --api-id xxxxx --request-parameters 'integration.request.header.Some-Header-Param'= 'SomeText'

It is giving the below error:

An error occurred (BadRequestException) when calling the UpdateIntegration operation: Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression specified: SomeText]

1개 답변
0
수락된 답변

After Searching for while I found the Answer from https://repost.aws/knowledge-center/api-gateway-vpc-link-integration

  1. To retrieve the integration ID, run the AWS CLI command get-integrations similar to the following:

aws apigatewayv2 get-integrations --api-id <api-id>

  1. Create and save a JSON file named integration.json in the following format:
{
    "ApiId": "<api-id>",
    "IntegrationId": "<integration id retrieved from previous step>",
    "RequestParameters": {
        "integration.request.header.ConnectionId": "context.connectionId", //passing context variable connectionId as ConnectionId header to backend
        "integration.request.header.any-header-key": "''static value'",   //passing static value as querystring to backend
        "integration.request.querystring.any-querystring-key": "'static value'"
    } 
} 
  1. To update the integration, run the AWS CLI command update-integration similar to the following:

aws apigatewayv2 update-integration --cli-input-json file://integration.json

  1. Deploy your API
profile picture
Aqib
답변함 5달 전
profile pictureAWS
전문가
검토됨 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠