How we can pass API payload in Step Function Dynamically? - aws-api-gateway

I created a Step function which will trigger by API Gateway with Input Parameters. Graph is here :
Below is my Step function code :
[
I'm trying to pass Body via API Gateway like below:
I'm getting below error while body request to API gateway
{
"error": "States.Runtime",
"cause": "An error occurred while executing the state 'API Gateway Invoke' (entered at the event id #2). The JSONPath '$.id' specified for the field 'Payload.$' could not be found in the input '{"ISIN":"12sd"}'"
}

Related

IICS Cloud Integration: Is there any way to use a child object in a REST API call through Service Connector?

When using a child object (relatedInvoices in the below example) in the REST API call in a Service connector, I get an error "Unable to parse the payload". The same API call in postman is successful, but not in IICS. Pls let me know if there is any fix for this or is there any other way we can approach this -
Method: POST
Request body ex:
{{
"PaymentNumber":"{$PaymentNumber}",
"PaymentDocument":"{$PaymentDocument}",
..
"relatedInvoices":
{
"invoiceNumber":"{$invoiceNumber}",
'invoiceAmount":"{$invoiceAmount}",
..
}
}}

Error in PayFort API while calling POSTMAN

I am calling payment API of payfort "https://sbcheckout.payfort.com/FortAPI/paymentPage". I pass all required parameters, but it gives me a response like:
{
"response_code": "00006",
"response_message": "Technical problem",
"fort_id": null,
"token": "914856uVZh0pnLDaRAXcVh2d8249912125834310800645126115901083"
}
Hello I have checked your error and it appears that you may not have written one of these correctly
Merchant Identifier
Access Code
SHA Request Phrase
SHA Response Phrase
you must ensure that you are also calling the testing/sandbox API URL

Issue in passing content as a body in Azure Data Factory

I am calling an Azure Function(HTTP trigger) in Azure Data Factory and the body is coming from a lookup activity (#activity('Lookup1').output.value) which is something like this
"body":[
{
"BaseObject": "2|03|01|01",
"BaseObjectDescription": "Cent",
"CreateDate": "30.09.2021"
},
{
"BaseObject": "9|03|01|01",
"BaseObjectDescription": "Pent",
"CreateDate": "30.09.2021"
}]
The above json when passed as body to Azure function activity, I get error as "Unexpected character encountered while parsing value: S." But if I hardcode and pass the same value in body of Azure function I get the output. When I hardcode it, I see in debug mode the body is passed as something like this
"body": "[\n {\n \"BaseObject\": \"02|03|01|01\",\n \"BaseObjectDescription\": \"Cent\",\n \"CreateDate\": \"30.09.2021\" },\n {\n \"BaseObject\": \"04|03|01|01\",\n \"BaseObjectDescription\": \"Pent",\n \"CreateDate\": \"21.09.2021\",\n },\n]"
So question is how do I change the json I am getting from lookup activity to something like above so that my Function recognizes this as body in Azure Data Factory.
Here is my configuration of Azure Function Linked Service. Why open in Azure Portal is Disabled. The error I get in ADF for Azure Function Activity is
"
Call to provided Azure function 'Function1' failed with status-'InternalServerError' and message - 'Invoking Azure function failed with HttpStatusCode - InternalServerError.'." While in Azure Function Logs I see the error message as below:
2022-01-06T10:14:42.403 [Information] C# HTTP trigger function processed a request.
2022-01-06T10:14:42.826 [Error] Executed 'Function1' (Failed, Id=c7f2488f-e08f-49a3-8f10-4e82a10d9ac0, Duration=270ms)The argument 'length' is smaller than minimum of '1' (Parameter 'length')
2022-01-06T10:16:40.934 [Information] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=5ff54bce-679d-4892-87a0-fb342ff02cc7)
2022-01-06T10:16:40.934 [Information] C# HTTP trigger function processed a request.
2022-01-06T10:16:40.994 [Error] Executed 'Function1' (Failed, Id=5ff54bce-679d-4892-87a0-fb342ff02cc7, Duration=2ms)Specified method is not supported.Specified method is not supported.
Use the lookup activity value as #activity('Lookup1').output.value[0] inside the body of Azure Function activity.
Lookup activity output:
Azure Function activity settings:
Body: #activity('Lookup1').output.value[0]
The value shown in input to Azure functions:

Can we Invoke AWS SNS service from snowflake external function through API gtw without lambda? must accept API query string parameters as well*

I am able to make calls through snowflake external function(with parameters) to API gateway and then able to invoke lambda. Question is - "I want invoke SNS without lambda hence I also need to handle the parameters from snowflake function in API gateway itself which will be used to invoke SNS" is it possible ??
Error: Request failed for external function EX_FN_API_EXCEPTIONS with
remote service error: 400 '{"message": "Missing required request
parameters: [subject, topicArn]"}'; requests batch-id: <>; request
batch size: 1 rows; request retries: 0; response time (last retry):
41.9ms
create or replace external function EX_FN_API_EXCEPTIONS(subject1 varchar, topicArn1 varchar, message1 variant)
returns variant
api_integration = aws_api_integration_exceptions
as 'https://tp7nyt3qq0.execute-api.us-east-1.amazonaws.com/dev/event';
select EX_FN_API_EXCEPTIONS('TEST SNOW SUBJECT', 'arn:aws:sns:us-east-1:account:riksd-0015-notification', null )
All I need is how to pass parameters from snowflake external function to below method request's query string parameters and also the Message body

Is it right to return validation error (400) on GET request in REST application?

I am building REST application and I need to implement filtering by GET parameters. For example filter objects with some particular type:
example.com/api/objects/?type=some_type
Question:
What REST endpoint should return if inputed type is incorrect?
Example: endpoint receives request
example.com/api/objects/?type=other_type
and other_type is not allowed type for object.
What error code I have to return?
(My versions:
400 - because input was not valid, but it is strange - return 400 error on GET request.
422 - I am not sure that this is logical error
Return empty response.
)
HTTP 400 Bad Request is correct, however if you response proper error message like the following, it would be very usefull
{
"code": <your error code>,
"validation":
{
"exception": "java.lang.IllegalArgumentException: Error parsing type"
},
"message": "Validation faild"
"request" : "example.com/api/objects/?type=other_type"
}