Curl Error when trying to POST to AWS endpoint - amazon-web-services

I got
error: {"error":"Unexpected token ‘"}
with the curl command below.
What gives?
curl -X POST \
-H "X-Parse-Application-Id:SomeID" \
-H "Content-Type: application/json" \
-d ‘{“number”:"3016524500"}’ \
http://somedomain.com/parse/functions/testFunction
Please suggest.

I think the issue is that you're using different characters than the actual ' and " characters. Try replacing ” with " and ‘ with '.

Related

Receiving Invalid Grant Type Error Received From AWS Cognito When Supply Auth Code : How do I get Id and access tokens for testing?

I am unable to successfully acquire an id token/access token from my AWS cognito user pool when I supply an auth code. I have written a shell script (see below), and receive invalid_grant back from the server.
I have encoded the base64 Authorization Basic header for client_id:client_secret generated with python as:
import base64
encode='my_client_id_string:my_client_secret_string'
base64.b64encode(encode)
#!/usr/bin/env sh
curl --location --request POST 'https://<domain>.auth.us-east-2.amazoncognito.com/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic <base64 encode string client_id:client_secret>' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'client_id=<client_id from app settings' \
--data-urlencode 'code=<code received from redirect url to my localhost app endpoint>' \
--data-urlencode 'redirect_uri=http://localhost:8000/my_redirect'
Any ideas?
Solved it!
The problem was caused by an invalid client id. I had supplied a typo for the client id value!

CardDav (iCloud) what can be a reason for patches forbidden responses?

Does anyone else also noticed strange forbidden responses for existing vcard files updates?
See my curl example:
curl --location --request PUT 'https://p52-contacts.icloud.com/1........4/carddavhome/card/53cd4fa9-6fb0-40c3-9975-ff41909c7d9c.vcf' \
--header 'Authorization: Basic [secret]' \
--header 'Content-Type: text/vcard; charset=utf-8' \
--data-raw 'BEGIN:VCARD
VERSION:3.0
N:Last;contact-update_simple;Middle;Prefix;Suffix
FN:Prefix contact-update_simple Last Suffix
UID:53cd4fa9-6fb0-40c3-9975-ff41909c7d9c
END:VCARD'
Response most time is "403 Forbidden" - but some calls seems to pass.

How to convert curl command to postman(PayPal disputes API)

I encountered a problem while developing here
This curl command is something I have n’t encountered before and it has n’t been resolved for a long time
Please help me
How to convert to postman format, my import using postman cannot be recognized correctly
code:
curl -v -X POST https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-27803/provide-evidence \
-H "Content-Type: multipart/related; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" \
-H "Authorization: Bearer Access-Token" \
-F 'input={
"evidences": [
{
"evidence_type": "PROOF_OF_FULFILLMENT",
"evidence_info": {
"tracking_info": [
{
"carrier_name": "FEDEX",
"tracking_number": "122533485"
}
]
},
"notes": "Test"
}
]
};type=application/json' \
-F 'file1=#NewDoc.pdf'
我自己解决了
看图片
目前只能使用curl成功 postman python requests php 都没有成功
主要还是后面这个#符号
enter image description here

To run curl command on postman getting error as Error while importing Curl: arg.startsWith is not a function

I have a curl link which is successfully run with terminal but i want to convert it as a POSTMAN request where link is,
curl -v --silent -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET -u <registry-user>:<registry-password> https://sc-docker-registry.eic.fullstream.ai/v2/<image-name>/manifests/<tag> 2>&1 --insecure | grep Docker-Content-Digest | awk '{print ($3)}'
I have set header and auth but unable to set 2>&1 --insecure | grep Docker-Content-Digest | awk '{print ($3)}'
Where do I set 2>&1 --insecure | grep Docker-Content-Digest | awk '{print ($3)}' command in postman
I had the issue when using "Copy all as cURL (bash)" instead of just "Copy as cURL (bash)".
A few concatenated curl commands were copied. And Postman's import didn't like that.
I had the same issue but chrome now gives you the option to copy curl as (bash) or (cmd). I had the issue when using copy as cmd but worked when I used copy as bash
I had the same error and I think it's unrelated to the pipeline arguments you sent at the end of the curl. Enclosing url part into double quotes helped with my case. Looks like its a bug in curl-to-postman library
Personally for me the problem was a semicolon at the end of the cURL request. Try to remove all the noise you can until you find what sort of character is making postman have that error
curl 'http://catalog.data.gov/api/3/' \
-H 'authority: 1fzqk3npw4.execute-api.us-east-1.amazonaws.com' \
-H 'accept: */*' \
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36' \
--compressed ;
Remove the semicolon at the end
I removed all the single quotes to Double quotes and it worked !!!
Not Working CURL
curl --location --request POST 'http://localhost/data/?type=MOBILE&value=77700023656' \
--header 'accept: */*'
WORKING CURL (changed single quotes --> double quotes)
curl --location --request POST "http://localhost/data/?type=MOBILE&value=77700023656" \
--header "accept: */*"
remove character \ in the end of all lines
for who is using vscode, replace all by regex

AWS S3 rest api signature

Can someone please help me with calculating the AWS_SIGNATURE in bash
Here is the GET I am trying to do:
curl -k \
-X GET \
-H "Host: ${AWS_BUCKET_NAME}.s3.eu-west-1.amazonaws.com" \
-H "Date: Tue, 27 Nov 2018 11:20:00 +0200" \
-H "Authorization: AWS ${AWS_ACCESS_KEY_ID}:${AWS_SIGNATURE}" \
"https://s3.eu-west-1.amazonaws.com/${AWS_BUCKET_NAME}/?list-type=2"
You need to install openssl and base64 encoder to create the signature.
Assume you supply value for each $variable
Signature=`echo -n $StringToSign | openssl sha1 -hmac $YourSecretAccessKeyID | base64`