I followed this tutorial to implement DynamoDB endpoint proxy service via API Gateway:
https://aws.amazon.com/blogs/compute/using-amazon-api-gateway-as-a-proxy-for-dynamodb/
I manage to implement the PutItem and Query actions, but when I try to make a DeleteItem action i get the following error:
"message": "The provided key element does not match the schema"
That's my Get Method Integration:
{
"TableName": "Notes",
"Key": {
"myID": {
"S": "$input.params('ID')"
}
}
}
where myID is the primary key,
Any help will be greatly appreciated!
Related
I am pretty sure this is something trivial, but I am a bit stuck with this.
I am trying to create an instance in Oracle Cloud in uk-london-1 region via OCI CLI tool.
I am getting
"code": "InvalidParameter",
"message": "AvailabilityDomain could not be inferred from the Request",
The command I am trying to use:
oci compute instance launch --availability-domain lMrS:UK-LONDON-1-AD-1 --compartment-id <myid> --shape VM.Standard.E2.1.Micro --subnet-id <subnetid> --image-id Canonical-Ubuntu-22.04-2022.06.16-0
I got the list of AD's via CLI
~$ oci iam availability-domain list
{
"data": [
{
"compartment-id": "ocid1.tenancy.oc1..###",
"id": "ocid1.availabilitydomain.oc1..###",
"name": "lMrS:UK-LONDON-1-AD-1"
},
{
"compartment-id": "ocid1.tenancy.oc1..###",
"id": "ocid1.availabilitydomain.oc1..###",
"name": "lMrS:UK-LONDON-1-AD-2"
},
{
"compartment-id": "ocid1.tenancy.oc1..###",
"id": "ocid1.availabilitydomain.oc1..###",
"name": "lMrS:UK-LONDON-1-AD-3"
}
]
}
And it is the same list of AD names I see in the Web UI.
Also I have similar error when trying to follow Oracle Cloud "Terraform: Create a Compute Instance" tutorial.
Any help will be appreciated!
Thanks to #urawesome, my compartment-id was wrong and the error returned is a bit misleading as well.
I used actual Compartment name from web UI, when it should have been ocid1.tenancy.### Mainly focused on availability-domain thinking that other parameters will throw different errors if they are invalid.
Correct compartment-id aka tenancy-id solved the issue.
Thanks!
I'm just doing the preparation for an integration with EasyPost's Shipping API, which will be server side C#, but we always build a PostMan collection for new integrations, so that we can test data separately from the application if there's an issue.
While I do love the fact that EP provide C# libraries and examples, I'm struggling to find anything that just gives me a list of required headers and the raw JSON format for the body of any requests. It feels a bit like they're just being a little too helpful.
I'll be looking at the Orders endpoint probably.
I've got an account, I've checked all their documentation and searched the internet but haven't found anything so I'm hoping I'm not the first developer to want to use a client application for testing outside my code.
Update:
EasyPost now does have a public workspace https://www.postman.com/easypost-api
with at least 1 public collection
The curl examples are basically the same as json:
For the Address creation example:
-d "address[street1]=417 MONTGOMERY ST"
is the equivalent of
{ "address": { "street1": "417 MONTGOMERY ST" } }
(you might have to escape some characters to be valid json).
Check out How to stimulate cURL request to a request using postman for postman with HTTP Basic Auth.
EasyPost does not provide a public Postman collection; however, here is an example of a shipment Postman body (raw) that could be used. You can adjust the values, actions, objects, etc to your needs.
Using the following, you shouldn't need to pass any headers. You'll pass your API key under the username field with the Basic Auth authorization type.
{
"shipment": {
"to_address": {
"id": "adr_123..."
},
"from_address": {
"id": "adr_123..."
},
"parcel": {
"id": "prcl_123..."
},
"carrier_accounts": {
"id": "ca_123..."
},
"options": {
"address_validation_level": "0"
}
},
"format": "json",
"controller": "shipments",
"action": "create"
}
I have:
An JavaScript Azure Function in an HTTP webhook configuration; the Function provides a URL; the Function performs an action
A webhook configured in the software I hope to receive notifications from
An Azure Logic App with an HTTP/webhook step that provides a URL for the webhook notification to go to
My goal is that the Azure Function's URL receives notifications from the software's webhook and performs an action. The Azure Logic App is for testing only.
What works
When the the Azure Logic App's URL is used in the software's webhook configuration, the desired action is performed. All works as expected.
The Azure Logic App's logging shows the JSON output from the incoming webhook. I expect (but believe this may be where I am going wrong) that this is the JSON the webhook is sending to the Azure Logic App's URL. When this JSON is used in the Azure Function UI's "Test" tab > "Request body" field, the desired action is performed. All works as expected.
When the Azure Function's URL and the JSON is in a Postman request, the desired action is performed. All works as expected.
What doesn't work
When the Azure Function's URL is used in the software's webhook configuration, no action is performed. This is of course my goal. From everything I have read, I understand that this URL as a webhook endpoint should work.
Azure Function's URL
This is from Get function URL > default (Function key).
https://<app_name>.azurewebsites.net/api/content?code=<api_key>
Other Azure Function config settings
Allowed HTTP methods: GET, POST
Authorization level: Function
The JSON I believe to be coming over the webhook
{
"headers": {
"Expect": "100-continue",
"Host": "redacted",
"X-Telligent-Webhook-Sender": "redacted",
"Content-Length": "16908",
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
}
I also tried with the following test code for the same results. It aligns more closely with the sample payload data provided by the software company:
What I tried
{
"events": [{
"TypeId": "ec9da4f4-0703-4029-b01e-7ca9c9ed6c85",
"DateOccurred": "2018-12-17T22:55:37.7846546Z",
"EventData": {
"ActorUserId": 9999,
"ContentId": "redacted",
"ContentTypeId": "redacted",
"ForumReplyId": 9999,
"ForumThreadId": 9999,
"ForumId": 9999
}
}]
}
Sample payload data
{
"events": [
{
"TypeId": "407ad3bc-8269-493e-ac56-9127656527df",
"DateOccurred": "2015-12-04T16:31:55.5383926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
},
{
"TypeId": "3b75c5b9-4705-4a97-93f5-a4941dc69bc9",
"DateOccurred": "2015-12-04T16:48:03.7343926Z",
"EventData": {
"ActorUserId": 2100,
"ContentId": "4c792b81-6f09-4a45-be8c-476198ba47be"
}
}
]
}
I do not know how to determine why the Azure Function is not triggered by the webhook. The software's API documentation does not seem to provide a way to look at the JSON being sent over the webhook, although in my inexperience I may be wrong.
Is there a mechanism within Azure, or Postman, or another tool that lets me see what JSON is being sent over the webhook? Or perhaps is there another approach to determining the cause of the issue?
Thank you for any help.
This is how I got the JSON file from Azure alerts.
Install Ruby on the server
Install Sinatra with following command gem install sinatra
Create file webhook.rb and paste code bellow
require 'sinatra'
set :port, 80
set :bind, '0.0.0.0'
post '/event' do
status 204 #successful request with no body content
request.body.rewind
request_payload = JSON.parse(request.body.read)
#append the payload to a file
File.open("events.txt", "a") do |f|
f.puts(request_payload)
end
end
Run the web service with command ruby webhook.rb
JSON fill be written to file events.txt
I have a PUT API Gateway endpoint which should be used to update a DynamoDB entry.
The id for that DynamoDB entry is given as the path parameter.
I have the following mapping template:
"application/json": {
"id": "$input.params('id')",
"title": "$input.json('$.title')"
}
The id is returned as expected.
If I submit this request body
{
"title": "Hello world"
}
I get the error Could not parse request body into json: Unexpected character (\'t\'
Here's the overview of my AWS management console:
what am I missing?
So I just found the solution:
"title": "$input.json('$.title')"
should be
"title": $input.json('$.title') (without the double quotes).
Source: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#input-variable-reference
I have tried to rin the xtify simple push api in post manbut it shows error. I have used the following json code in raw body:
{
"apiKey":"12345678-7d94-415a-9eed-00987654321",
"appKey":"12345678-4ab7-4633-8a7c-00987654321",
"sendAll": true,
"content": {
"message": "Arma virumque cano, troiaeque primus ab oris",
"sound": "default.caf",
"badge": "+1",
"action": {
"type": "CUSTOM",
"label":"Open",
"data": "{'action_id': 'ABC', inum: '123456'}"
}
}
}
I have valid api key and app key. I have changed here the api key and app key for security reason. Using header Content-Type=application/json but it shows the error message:
Invalid Application Key
Actually I have used this url https://api.xtify.com/2.0/push for sending push. But it should be like this https://euapi.xtify.com/2.0/push. It works now