Looking at the RequestPermissions API, it says that the scope is supposed to be a string. However, I have been unsuccessful in finding out how to specify more than one scope (specifically EXPRESS_CHECKOUT and REFUND). Comma-separated, semi-colon, and even using their NVP list syntax didn't work. A CURL sample would be greatly appreciated.
Comma-separated example...
curl -s --insecure -H
"X-PAYPAL-SECURITY-USERID: API_USERNAME"
-H "X-PAYPAL-SECURITY-PASSWORD: API_PASSWORD"
-H "X-PAYPAL-SECURITY-SIGNATURE: API_SIGNATURE"
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV"
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV"
-H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T"
https://svcs.sandbox.paypal.com/Permissions/RequestPermissions -d
"requestEnvelope.errorLanguage=en_US&scope=EXPRESS_CHECKOUT,REFUND&callback=http://my/callback"
When I make that request, I get back "Invalid request parameter scope with value EXPRESS_CHECKOUT,REFUND"
Ok. Found the answer randomly. The scope variables must be set using "scope(0)=SCOPE_1&scope(1)=SCOPE_2..."
So, the cURL request would look like this...
curl -s --insecure -H
"X-PAYPAL-SECURITY-USERID: API_USERNAME"
-H "X-PAYPAL-SECURITY-PASSWORD: API_PASSWORD"
-H "X-PAYPAL-SECURITY-SIGNATURE: API_SIGNATURE"
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV"
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV"
-H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T"
https://svcs.sandbox.paypal.com/Permissions/RequestPermissions -d
"requestEnvelope.errorLanguage=en_US&scope(0)=EXPRESS_CHECKOUT&scope(1)=REFUND&callback=http://my/callback"
If you're using their JSON API, scope can be an array.
Related
How do i add the 2fa filter in curl for the github api?Here is an image of the documentation page, however it does not specify how to add the filter for 2fa.
Thanks so much!
I have tried using a "?":
curl
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer """
-H "X-GitHub-Api-Version: 2022-11-28"
https://api.github.com/orgs/"my_org_name"/members?2fa_disabled
According to the documentation, the query-parameter you need is called filter with the value 2fa_disabled. Therefore your curl command should look the following:
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/members?filter=2fa_disabled
Keep in mind that this options is only available for organization owners.
Documentation: https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#list-organization-members
I am trying to query Github's REST API to list workflow runs for specific date ranges.
Here's an example curl call:
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_ACCESS_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/[OWNER]/[REPO]/actions/runs?created:2023-01-01..2023-01-02"
From what I understand from the documentation, this is how I should be able to retrieve only results from Jan 1st and 2nd of 2023. But it does not work, my result is always the latest runs.
What am I doing wrong?
you should use the = symbol instead of :, like:
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_ACCESS_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/[OWNER]/[REPO]/actions/runs?created=2023-01-01..2023-01-02"
Under Geoserver, How do we create the WMTSLayer once the WMTSStore is establish via REST API ?
Trying to follow the swagger documentation under here,
https://docs.geoserver.org/latest/en/api/#1.0.0/layers.yaml
But can't find the correct url to work for it. Get 404 when I try this using curl
curl -v -u admin:geoserver -X POST http://localhost:8085/geoserver-cloud/rest/workspaces/{workspaceName}/wmtsstores/{wmststoreName}/wmtslayers -H "accept: application/json" -H "content-type: application/json" -d "{\"featureType\":{\"name\":\"World_Imagery\"}}"
Also looked under here,
https://docs.geoserver.org/latest/en/api/#1.0.0/wmtslayers.yaml
And tried below url for it. Get 500 when I try this using curl
curl -v -u admin:geoserver -X POST http://localhost:8085/geoserver-cloud/rest/workspaces/{workspace}/wmtsstores/{wmtsstore}/layers -H "accept: application/json" -H "content-type: application/json" -d "{\"featureType\":{\"name\":\"World_Imagery\"}}"
Found it, need to pass wmtsLayer
curl -v -u admin:geoserver -X POST http://localhost:8085/geoserver-cloud/rest/workspaces/{workspace}/wmtsstores/{wmtsstore}/layers -H "accept: application/json" -H "content-type: application/json" -d "{ \"wmtsLayer\": { \"name\": \"NatGeo_World_Map\" } }"
I'm doing a curl to send a POST in my group, and it doesn't works, it posts on the All Company Network even if I sent the group_id.
curl -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer OAUTHTOKENHERE" -X POST -d '{"activity":{"actor":{"email":"MYEMAIL"},"action":"create"}}' https://www.yammer.com/api/v1/messages.json?body=TestingfromYammersAPI&group_id=GROUPID
I'm writing the right group_id, and still not reading that argument.
Does anyone has this problem too?
Yammer's API docs:
https://developer.yammer.com/docs/messages-json-post
The problem was that I wasn't quoting the URL -___-
Working code:
curl -H 'accept: application/json' -H 'authorization: Bearer OAUTHTOKENHERE' -H 'content-type: application/json' -X POST -d ' ' 'https://www.yammer.com/api/v1/messages.json?body=MESSAGE_HERE&group_id=GROUP_ID'
I'm trying to play with the PreApproval from Adaptive Payments. Specifically, to go through the four steps from the documentation on Preapproval.
I'm stuck at the Step 1: Set Up the Preapproval with a curl command:
$ curl -s --insecure \
-H "X-PAYPAL-SECURITY-USERID: myuserid.gmail.com" \
-H "X-PAYPAL-SECURITY-PASSWORD: mypass" \
-H "X-PAYPAL-SECURITY-SIGNATURE: mysignaturestring" \
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" \
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" \
-H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" \
https://svcs.sandbox.paypal.com/AdaptivePayments/Preapproval -d \
"cancelUrl=http://www.yourdomain.com/cancel.html
¤cyCode=USD
&endingDate=2014-09-10T22:00:00Z
&maxAmountPerPayment=200.00
&maxNumberOfPayments=30
&maxTotalAmountOfAllPayments=1500.00
&pinType=NOT_REQUIRED
&requestEnvelope.errorLanguage=en_US
&returnUrl=http://www.yourdomain.com/success.html
&startingDate=2014-08-10T22:00:00Z"
Instead of a preapprovalKey, I receive an error. I know it's something wrong with the data I send, but I can't figure out what:
esponseEnvelope.timestamp=2014-08-05T01:24:55.289-07:00
&responseEnvelope.ack=Failure
&responseEnvelope.correlationId=7c6db7beda57a
&responseEnvelope.build=11853342
&error(0).errorId=580001
&error(0).domain=PLATFORM
&error(0).subdomain=Application
&error(0).severity=Error
&error(0).category=Application
&error(0).message=Invalid request: Data validation warning(line -1, col 0): 2014-09-10T22:00:00Z
&error(0).parameter(0)=Data validation warning(line -1, col 0): 2014-09-10T22:00:00Z
Please note that:
my API credentials are OK, I've successfully tested them on Express Checkout from the documentation
some fields are according to documentation while others are exactly like in the docs copy pasted:
startingDate is in the future, the docs say to not be today's date (the date of the post) or after end date.
endingDate - startingDate is one month, less than a year as they say in the docs.
I also tried using https://apigee.com/console/paypal in case I was doing sth wrong with curl
Damn, I figured it out due to my indentation on SO to have it look pretty for you guys. It's because of the whitespace enters (\n's) in the -d \ "cancelUrl=... ¤cyCode=USD & ...".
Thanks, so the correct one for reference here is:
$ curl -s --insecure \
-H "X-PAYPAL-SECURITY-USERID: myuserid.gmail.com" \
-H "X-PAYPAL-SECURITY-PASSWORD: mypass" \
-H "X-PAYPAL-SECURITY-SIGNATURE: mysignaturestring" \
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" \
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" \
-H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" \
https://svcs.sandbox.paypal.com/AdaptivePayments/Preapproval -d \
"cancelUrl=http://www.yourdomain.com/cancel.html¤cyCode=USD&endingDate=2014-09-10T22:00:00Z&maxAmountPerPayment=200.00&maxNumberOfPayments=30&maxTotalAmountOfAllPayments=1500.00&pinType=NOT_REQUIRED&requestEnvelope.errorLanguage=en_US&returnUrl=http://www.yourdomain.com/success.html&startingDate=2014-08-10T22:00:00Z"