is it possible to call a Google publish API with json service account? - api

There is an API.
https://developers.google.com/android-publisher/api-ref/rest/v3/edits.deobfuscationfiles/upload
POST https://androidpublisher.googleapis.com/upload/androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/deobfuscationFiles/{deobfuscationFileType}
Also example with curl:
curl --request POST \
'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/[PACKAGENAME]/edits/[EDITID]/apks/[APKVERSIONCODE]/deobfuscationFiles/[DEOBFUSCATIONFILETYPE]?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
And there is service-api-account.json
How to call API with service json account?

Related

How to retrieve warehouse slots with Shippingbo API?

We are using Shippingbo as WMS
I want to retrieve a list of slots for a specific product
So, I tried to request SlotContent: https://app.shippingbo.com/slot_contents?search[product_id__eq]=16794293 but it doesn't work
Is any other solution ?
There is an easy way to do this, you juste have to request the warehouse_slots endpoint
curl --request GET \
--url https://app.shippingbo.com/warehouse_slots?search[product_id__eq][]=21890886 \
--header 'Content-Type: application/json' \
--header 'X-API-TOKEN: ' \
--header 'X-API-USER: ' \
--header 'X-API-USER-ID: ' \
--header 'X-API-VERSION: '

aws cognito get jwt token in single api call

How to get jwt token in single step(api call) from aws cognito oauth2/token endpoint passing username and password
curl --location --request POST 'https://xxx.auth.us-east-2.amazoncognito.com/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic a......k' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=t34...nu'
--Authorization base64ecoded username:password
Response- "error": "invalid_client"
App client settings :
Allowed OAuth Flows : Authorization code grant, Implicit Grant
Allowed OAuth scope : email , openid
App clients : ALLOW_USER_PASSWORD_AUTH
I tried oauth2/authorize too but getting html page in response
There's no need to add the Authorization header. Instead, use the code you see in the URL. This worked for me.
curl --location --request POST 'https://xxx.auth.us-east-2.amazoncognito.com/oauth2/token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'grant_type=client_credentials'
--data-urlencode 'client_id=t34...nu'
--data-urlencode 'code=afa78ac6-..-b8dd-5b'
--data-urlencode 'redirect_uri=path'
The client credentials flow to the token endpoint is to receive an access token for machine to machine communication. It is not based on a given user so no user name and password is required.
See 'Exchanging Client Credentials for an Access Token'
https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html
To sign in with the oauth endpoints it is intended to do this via the HostedUI or an external IDP. However, you can do it pro-grammatically but will require a call to authorize and login endpoint.. You can see an example in python here:
https://github.com/starkshaw/aws-cognito-user-pool-custom-scope
This is a late answer, but following worked for me nicely with a client_credentials workflow.
curl --request POST \
--url 'https://XYZ.auth.us-west-2.amazoncognito.com/oauth2/token' \
--header 'content-type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=7*******e \
--data client_secret=2*****5pjk9valn
Here is the response I got:
{"access_token":"eyJra*****eA","expires_in":3600,"token_type":"Bearer"}

curl response is on one line rather than multiple

I used the following curl command to receive tweets as well as info of tweets from a specific account:
curl --request POST \
--url https://api.twitter.com/1.1/tweets/search/fullarchive/production.json \
--header 'authorization: Bearer AAAAAAAAAAAAAAAAAAAAAHzE8wAAAAAATpIskAbraT5V0OSNaWKwrt%2Fz99I%3DcS8seKux26Ic3wcNjpAwPVFJ5I055ZuLyYAQNTMsIx55o1nIK5' \
--header 'content-type: application/json' \
--data '{
"query":"from:TwitterDev lang:en",
"maxResults": "100",
"fromDate":"201802010000",
"toDate":"201802282359"
}'
the response I receive is all on one line, my question is how can I separate the line of response based on each tweet received?

Download exact email data using bounced from API call

How can I get all the data from the bounced emails using API call.
When I use my API call to get data, I only retrieve first 500 records using curl, Can it be possible to get all the data and download in a file.
The command which I am using is as below ... I tried to increase limit of the API call with 501 below was the error ? Can any one let me know how to resolve ?
curl --request GET \
--url https://${API_CALL} \
--header 'accept: application/json' \
--header 'authorization: Bearer ${AUTH_TOKEN}' \
curl --request GET \
--url https://${API_CALL}?limit=501 \
--header 'accept: application/json' \
--header 'authorization: Bearer ${AUTH_TOKEN}' \
{"errors":[{"field":"limit","message":"must be between 0 and 500"}]}

Php script for google firewall API

I am trying to do a simple script to change firewall rules on my VM hosting. I used the google API explorer, and the script generated is as follows
curl --request PUT \ 'https://www.googleapis.com/compute/v1/projects/learnstoresg/global/firewalls/intranet2?requestId=00000000-0000-0000-0000-000000000033' \
--header 'Authorization: Bearer [YOUR_BEARER_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"allowed":[{"IPProtocol":"TCP","ports":["4033","4016"]}],"sourceRanges":["101.127.7.227"]}' \
--compressed
Anyone has an example of php script for google firewall or can help me convert this CURL statement into a php script?