In uber api facing an issue while using authentication generate api - api

I am working with authentication token generate uber api.
`
curl -X POST 'https://login.uber.com/oauth/v2/token' \
-d 'client_id=<CLIENT_ID>' \
-d 'client_secret=<CLIENT_SECRET>' \
-d 'grant_type=client_credentials' \
-d 'scope=eats.deliveries direct.organizations'
`
I am getting this error. while using this.
error :-
`
Array
(
[error] => invalid_scope
[error_description] => scope(s) are invalid
)
`
I Try This PHP Authentication Code :--
`
$post = array(
'client_secret' => $client_secret,
'client_id' => $client_id,
'grant_type' => 'client_credentials',
'scope' => 'eats.deliveries direct.organizations',
);
`
Error show in 'Scope' Parameters

Related

Paypal API subscription curl sandbox catalog products Authorization failed due to insufficient permissions

This question is about paypal API catalog when try to create a production and to do a subscription.
I'm following this tutorial https://developer.paypal.com/docs/subscriptions/integrate/
I'm able to get my token, but trying to create a product I get "Authorization failed due to insufficient permissions"
Here my code
// GET TOKEN
$paypalcurl = 'curl -v https://api-m.sandbox.paypal.com/v1/oauth2/token -H "Accept: application/json" -H "Accept-Language: en_US" -u "'.($paypal_client_id.':'.$paypal_client_secret).'" -d "grant_type=client_credentials"';
$ptoken_result = json_decode(exec($paypalcurl.' 2>&1'),true);
$ptoken = $ptoken_result['access_token'];
// CREATE PRODUCTI AND GET PRODUCT ID
$paypalcurl_create_prodct = 'curl -v -X POST https://api-m.sandbox.paypal.com/v1/catalogs/products \
-H "Content-Type: application/json" \
-H "Authorization: Bearer '.$ptoken.'" \
-d \'{
"name": "Video Streaming Service test",
"description": "Video streaming service",
"type": "SERVICE",
"category": "SOFTWARE",
"home_url": "https://www.example.com/"
}\'';
$pcreate_result = json_decode(exec($paypalcurl_create_prodct.' 2>&1'),true);
if ( ADMIN_PASS == 1 ) { echo str_replace(',',',<br>',var_export($pcreate_result,true)); }
Here the result
array ( 'name' => 'NOT_AUTHORIZED',
'message' => 'Authorization failed due to insufficient permissions.',
'debug_id' => 'f7d1051f9daf3',
'details' => array ( 0 => array ( 'issue' => 'PERMISSION_DENIED',
'description' => 'You do not have permission to access or perform operations on this resource.',
),
),
'links' => array ( 0 => array ( 'href' => 'https://developer.paypal.com/docs/api/v1/billing/subscriptions#NOT_AUTHORIZED',
'rel' => 'information_link',
'method' => 'GET',
),
),
)
What I'm I missing ?
After the comment I realize that it was simply a delay.
1- go to https://developer.paypal.com/developer/applications/
2- click on the app you created
3- there is a checkmark Accept paymentsEnable one-time and subscription payments. Advanced options and CLICK on "Advanced options"
4- checkmark "Billing agreements" and "Future payments" and save
5- wait some hours
6- voilà!

The result of the search query differs in the API and Shutterstock website

please help me.
The result of the search query differs in the API and Shutterstock website.
What am I doing wrong?
API returns only 4 results, but at shutterstock - thousands
My code:
$queryFields = [
"query" => "осень лес векторы"
];
$options = [
CURLOPT_URL => "https://api.shutterstock.com/v2/images/search?" . http_build_query($queryFields),
CURLOPT_USERAGENT => "php/curl",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer xxxxx"
],
CURLOPT_RETURNTRANSFER => 1
];
$handle = curl_init();
curl_setopt_array($handle, $options);
$response = curl_exec($handle);
curl_close($handle);
$decodedResponse = json_decode($response);
echo "<pre>";
print_r( $decodedResponse );
echo "</pre>";
Thank you.
The default API access (Self Serve, or Free product) is limited to a subset of Shutterstock's library - only about 1 million images. That's why you only see 4 results for your search compared to the website. If you need access to more content, just reach out to the team - https://developers.shutterstock.com/contact-us

How to make php api call to CloudFlare to Purge individual files by URL from cache

this code worked good to Purge All files from cache .
Example:
$authKey = "MyKEY";
$authEmail = "myEMAIL";
$zoneId = "MYZONEID";
$endpoint = "purge_cache";
$data = [
"purge_everything" => true
];
$url = "https://api.cloudflare.com/client/v4/zones/{$zoneId}/{$endpoint}";
$opts = ['http' => [
'method' => 'DELETE',
'header' => [
"Content-Type: application/json",
"X-Auth-Key: {$authKey}",
"X-Auth-Email: {$authEmail}",
],
'content' => json_encode($data),
]];
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
But I need Purge individual files by URL how can I do that via PHP ?
On api page I found this link: https://api.cloudflare.com/#zone-purge-individual-files-by-url
but I don't now how to make it via php ?
You need to pass an array with files - like explained on the API Docs
In your example that would be something like
$data = '{"files":[
"http://www.example.com/css/styles1.css",
"http://www.example.com/css/styles2.css",
"http://www.example.com/css/styles3.css"
]}';

quickblox 500 Internal error REST API call

We want to create Quickblox user through our WEB-Java application.
To get the same working we are trying to first make the REST API calls through Postman and CURL and then proceed to Java Code.
However, we are getting 500 internal error
URL
https://api.quickblox.com/session.json
Header
Content-Type: application/json"
QuickBlox-REST-API-Version: 0.1.0
body
{"application_id": “35221”, "auth_key": "wU8JrJ-DKamUB8v", "timestamp": “1456378718”, "nonce": “1112”, "signature": "81f3967265c87de025010eb9298d169555085e91”}
To generate the signature
application_id=35221&auth_key=wU8JrJ-DKamUB8v&nonce=1112&timestamp=1456378718
Here is the response we are getting `Connection → keep-alive
Content-Length → 948
Content-Type → text/html; charset=utf-8
Date → Thu, 25 Feb 2016 05:48:08 GMT
Server → nginx/1.8.0
Status → 500 Internal Server Error
X-Rack-Cache → invalidate, pass
X-Request-Id → 3a47c3daaf9ad353a5b592459c6f3345
X-Runtime → 0.003346`
As to my understanding the parameters are as suggested in the API docs. Please help as we are bit stuck at it and are not able to move forward.
Also posting a curl equivalent that results in same error
curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0” \
-d '{"application_id": “35221”, "auth_key": "wU8JrJ-DKamUB8v", "timestamp": “1456378718”, "nonce": “1112”, "signature": "81f3967265c87de025010eb9298d169555085e91”}’ \
https://api.quickblox.com/session.json
application_id=35221&auth_key=wU8JrJ-DKamUB8v&nonce=1112&timestamp=1456378718
authorisation secret - FEu2AN8CfgU7VF4
thanks,
aakash
First define all the related to the application:
DEFINE('APPLICATION_ID', 23424);
DEFINE('AUTH_KEY', "dfsadfasdfsadf-");
DEFINE('AUTH_SECRET', "23421342134");
DEFINE('USER_LOGIN', "rahul");
DEFINE('USER_PASSWORD', "fghdf56456456");
// Quickblox endpoints
DEFINE('QB_API_ENDPOINT', "https://api.quickblox.com");
DEFINE('QB_PATH_SESSION', "session.json");
After define, create signature and pass $post_body in curl session api hit, get token and use token in all the webservices php:
$nonce = rand();
$timestamp = time();
$signature_string = "application_id=".APPLICATION_ID."&auth_key=".AUTH_KEY."&nonce=".$nonce."&timestamp=".$timestamp."&user[login]=".USER_LOGIN."&user[password]=".USER_PASSWORD;
$signature = hash_hmac('sha1', $signature_string , AUTH_SECRET);
$post_body = http_build_query(array(
'application_id' => APPLICATION_ID,
'auth_key' => AUTH_KEY,
'timestamp' => $timestamp,
'nonce' => $nonce,
'signature' => $signature,
'user[login]' => USER_LOGIN,
'user[password]' => USER_PASSWORD
));

Azure "Easy Tables" Rest API body

I am currently experimenting with Azure's new "Easy Tables". I have read that it's completely RESTful and I am fully capable of "GET"ting the data in the tables but somehow, I'm not sure how to insert the data I tried using "POST" but no matter what I put into the "data" part of my curl request, it always says
{"error":"An item to insert was not provided"}
Can someone tell me how the body should look like? I'm really getting desperate here...
My table looks like this:
id | createdAt | updatedAt | version | deleted | orgID
notice that only orgID is a column inserted by me
Thanks in advance!
Here is what a request would look like using curl:
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
"id" :"1111",
"orgID" : "1234"
}' "http://<your_site_host>/tables/<tablename>?zumo-api-version=2.0.0"
Hope it helps.
$urlAzure = "https://<your_app>.azurewebsites.net/tables/<your_table>";
$data = array (
'<column1>' => <some_text>,
'<column2>' => <some_text>
);
$options = array(
'http' => array(
'method' => 'POST',
'content' => json_encode( $data ),
'header'=> "Content-Type: application/json\r\n" .
"Accept: application/json\r\n"
)
);
$context = stream_context_create($options);
$result= file_get_contents($urlAzure, false, $context);
if ($result === FALSE) { /* Handle error */ }