Getting an INVALID_REQUEST Uber API - uber-api

In this call to Uber API:
curl -F 'client_secret=<CLIENT_SECRET>' \
-F 'client_id=<CLIENT_ID>' \
-F 'grant_type=authorization_code' \
-F 'redirect_uri=<REDIRECT_URI>' \
-F 'scope=profile' \
-F 'code=<AUTHORIZATION_CODE>' \
https://login.uber.com/oauth/v2/token
from: https://developer.uber.com/docs/riders/references/api/v2/token-post
It was working before, but now I am getting this error:
{
"error": "invalid_request"
}
Where can I find more details about it?
At least know which of the parameters is wrong or invalid?

Related

How to send HTTP request multipart/form-data Content-Type on Apex Salesforce

I need to recreate this curl post using Apex and I can't find a way to do it.
Seems like Salesforce doesn't support this kind of Content-Type.
curl:
curl -i -X POST \
-H "Content-Type:multipart/form-data" \
-F "message=Images Test" \
-F "login=LOGIN" \
-F "password=PASSWORD" \
-F "to=9999999999" \
-F "image=#\"./20190914_132720.jpg\";type=image/jpeg;filename=\"20190914_132720.jpg\"
Anyone has an example of this on Apex?
Thank you

Vault plugin error: unable to determine plugin type

I am getting this error:
Error writing data to sys/plugins/catalog/example-auth-plugin: Error making API request.
URL: PUT http://127.0.0.1:1234/v1/sys/plugins/catalog/example-auth-plugin
Code: 500. Errors:
* 1 error occurred:
* unable to determine plugin type
After running this command:
# vault write sys/plugins/catalog/example-auth-plugin \
> sha_256="${SHA256}" \
> command="vault-auth-plugin-example"
I am running everything in a container.
podman run \
--rm \
--cap-add=IPC_LOCK \
-p '8200:8200' \
-e 'VAULT_ADDR=127.0.0.1:1234' \
-e 'VAULT_DEV_LISTEN_ADDRESS=127.0.0.1:1234' \
-v './data/:/var/lib/vault' \
-v './code/vault-auth-plugin-example:/etc/vault/plugins/vault-auth-plugin-example' \
-e 'VAULT_LOCAL_CONFIG={"backend": {"file": {"path": "/vault/file"}}, "log_level": "debug", "disable_mlock": true, "listener": [{"tcp": {"tls_disable": true}}], "plugin_directory": "/etc/vault/plugins/", "default_lease_ttl": "168h", "max_lease_ttl": "720h"}' \
--name=dev-pam-vault \
vaultplugin
Vault version: Vault v1.3.0
I did run this command first:
export SHA256=$(shasum -a 256 "/etc/vault/plugins/vault-auth-plugin-example" | cut -d' ' -f1)
I also tried:
# vault write sys/plugins/catalog/example-auth-plugin \
> sha_256="${SHA256}" \
> command="vault-auth-plugin-example"
But then I get this error:
Error writing data to sys/plugin/catalog/example-auth-plugin: Error making API request.
URL: PUT http://127.0.0.1:1234/v1/sys/plugin/catalog/example-auth-plugin
Code: 404. Errors:
* 1 error occurred:
* unsupported path
Any ideas?
Thank you in advance.

Post photos to an album using a batch request and curl

I'm trying to post a number of photos to an already created album using cURL with the following command:
curl -F 'access_token=<>' \
-F 'batch=[ \
{"method":"POST","relative_url":"/album_id/photos","url":"<photo_url>"}, \
{"method":"POST","relative_url":"/album_id/photos","url":"<photo_url>"}]' \
https://graph.facebook.com
The error I'm getting is (#324) Requires upload file. Is it even possible to post photos in a batch request to an album and if so what is the correct way to do it with cURL? Thanks!
Edit: the correct command thanks to CBroe is:
curl -F 'access_token=<>' \
-F 'batch=[ \
{"method":"POST","relative_url":"/album_id/photos","body":"url=<photo_url>"}, \
{"method":"POST","relative_url":"/album_id/photos","body":"url=<photo_url>"}]' \
https://graph.facebook.com

Parse RESET API for Login

I am using Parse REST Login API but I am getting invalid login parameter error. Then I tried log in example from https://parse.com/docs/rest/guide/#users-logging-in
> curl -X GET \
-H "X-Parse-Application-Id: <App_ID>" \
-H "X-Parse-REST-API-Key: <REST_ID>" \
-H "X-Parse-Revocable-Session: 1" \
-G \
--data-urlencode 'username=<username>' \
--data-urlencode 'password=<password>' \
https://api.parse.com/1/login
I used above curl command as it is (replacing AppID/RESTID/username and password) on terminal and I got same error
{"code":101,"error":"invalid login parameters"}
I believe above command should work as it is on terminal. Did anyone used REST API for log in?

watson visual recognition error 400: cannot execute learning task: no classifier name given

I was about to create a new classifier and train the visual recognition with pictures, but I got this error code which is stated in title when I curl following command
curl -u "0xxxxxxxxxxx":"vxxxxxxxxxxxxxx" \
-X POST \
-F "positive_examples=#bottle-positive.zip" \
-F "negative_examples=#bottle-negative.zip" \
-F "name=plasticbottle" \
-k "https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classifiers?version=2015-12-02"
To set the classifiers you want to use you have to send a JSON containing something like:
{"classifier_ids": ["ClassifierName"]}
So your curl should be something like:
curl -u "username":"pwd" \
-X POST \
-F "images_file=#imagefilename.jpg" \
-F "classifier_ids={\"classifier_ids\":[\"ClassifierName\"]}"
"https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classify?version=2015-12-02"
I'm not sure what was the problem using V2 api, but now, using V3 API your CURL should look like this example
curl -X POST
-F "apple_positive_examples=#apples1.zip"
-F "banana_positive_examples=#yellow.zip"
-F "orange_positive_example=#pos_ex.zip"
-F "negative_examples=#vegetables.zip"
-F "name=fruit"
"https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classifiers?api_key={api-key}&version=2016-05-20"
So your CURL for bottle should be like
curl -X POST
-F "bottle_positive_examples=#bottle-positive.zip"
-F "negative_examples=#bottle-negative.zip"
-F "name=plasticbottle"
"https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classifiers?api_key={api-key}&version=2016-05-20"
Note that you now should use an api_key to authenticate and no longer a user/pass
This is documented in the v3 doc:
https://www.ibm.com/watson/developercloud/visual-recognition/api/v3/#create_a_classifier