Hi,
I’m using serverless for deploying some API endpoints and I don’t know how to create path parameters properly.
Endpoint with path parameter:
getUserById:
handler: functions/users_handler.getUserById
events:
- http:
path: v1/users/{userId}
method: get
cors: true
request:
paths:
userId: true
template:
application/json: >
{
“id”: “$input.params(‘userId’)”
}
The problem
What I see is that the SDK generation option for objective-C does NOT include the path parameter in the function that is related with to that endpoint (I meant the function is not generated to expect the UserId and must be modified manually)
Generated function:
- (AWSTask *)v1UsersUserIdGet {
NSDictionary *headerParameters = @{
@"Content-Type": @"application/json",
@"Accept": @"application/json",
};
NSDictionary *queryParameters = @{
};
NSDictionary *pathParameters = @{
};
return [self invokeHTTPRequest:@"GET"
URLString:@"/v1/users/{userId}"
pathParameters:pathParameters
queryParameters:queryParameters
headerParameters:headerParameters
body:nil
responseClass:nil];
}
By the way, I tried to create the resource by hand using the amazon web console and the SDK generation creates the function properly with the userId parameter.
Any ideas?
Thank you in advance
Regards