processing application response from apply with linkedin - api

I am trying to get the response returned by the Apply with LinkedIn plugin. I am using Zend Framework. I have tried using the sample code from linkedIn
<?php
// access raw HTTP POST data
$post_body = file_get_contents('php://input');
$application = json_decode($post_body);
// confirm success by writing applicant name to the error log
error_log($application->person->firstName . " " . $application->person->lastName);
// now parse $application and insert data into a DB
// or perform another action
?>
pasted this in my controller and then my view but no success.
my data-url is the url of the current page...
Could anyone show me how this is suppose to be done PHP or javascript (need to get the response into the database).
Thanks.

Try replacing
$post_body = file_get_contents('php://input');
With:
$post_body = $this->getRequest()->getRawBody();
Where $this refers to the current request. I'm not positive if you get this for free..., but I'm hoping you can take this from here. I'm not a ZF expert.

Related

Google Sheet API batchUpdateByDataFilter PHP Function

https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdateByDataFilter
We have used above function in our code, while we are passing the more than 50 or 100 records within the array records then given 400 bad request array in response.
Can anyone describe the limit of the total values that we are going to pass within the above function?
Here is my code:
$batchupdate = array("valueInputOption" => "RAW", "data" => $dataarray);
try {
$requestBody = new Google_Service_Sheets_BatchUpdateValuesByDataFilterRequest($batchupdate);
$response = $service->spreadsheets_values->BatchUpdateByDataFilter($spreadsheetId, $requestBody);
}
catch(Exception $e) {
echo 'Message: ' . $e->getMessage();
}
Troubleshooting:
Problems with the Request
Until you attach a sanitized version of your Request body we cannot be sure about the root-cause of the problem you are facing.
However, an error 400 means that the request you did is invalid. So, most likely, the problem is in that.
Check if your request object is formatted as detailed on the documentation.
Problems with the Client
If you are able to use the Try this API sidebar with the same Request Body then it could be related to the PHP client.
Note: This is language independent. Create a JSON Object that has the same structure as your request body.
If that's the case, we will need to see more of your code to verify that you are not using your valid Request body in an invalid way (eg. sending it encapsulated in another object).
By referencing the PHP Library documentation you can see the properties of the objects you can use.

How to use shutterstock API to search and get photos in a simple way

I am making a site that allows users to search and send to print a shutterstock photo
Like this one:
https://wallprint.ee/
I am following the Shutterstock API documentation and trying to use this to connect, search and pick photos:
https://github.com/shutterstock/php-shutterstock-api
is this the best and easiest way to do it?!!
This is the way I am trying now:
require_once __DIR__ . '/vendor/autoload.php';
$clientId = '***';
$clientSecret = '****';
$client = new Shutterstock\Api\Client($clientId, $clientSecret);
var_dump($client);
// perform an image search for puppies
$client->get('images/search', array('query' => 'puppies'));
$imageResponse = $client->get('images', array('id' => array(1, 2, 3)));
if ($imageResponse->getStatusCode() != 200) {
// error handler
}
$images = $imageResponse->getBody()->jsonSerialize()['data'];
// etc
I expected:
Some kind of response with the content.
I got
Client error: GET https://api.shutterstock.com/v2/images?id=1&id=2&id=3 resulted in a 403 Forbidden response: {"message": "You do not have access to this route. Please contact api#shutterstock.com for more information"}
I read that since I use 'get'
I am told that a free APP can't do using get:
https://developers.shutterstock.com/documentation/authentication#accounts-and-limitations
I wrote about that already to api#shutterstock.com
But what options do I have to develop it in a simplest and painfree manner?
I'm Errol and I work on the API here at Shutterstock. Typically, you will receive this error because your app does not have access to call that route.
Unfortunately, there is no other options to achieve what wallprint is doing without having print partnership with Shutterstock. We want you to have access to the API endpoints you need that way developers like yourself can create awesome apps, however, it needs to be done in a way that doesn't violate Shutterstocks license or terms of service.
Should you have any questions or concerns about this, please drop us a message at api#shutterstock.com

Zoho API file upload error "Unable to process your request. Please verify whether you have provided proper file."

I want to upload file to zoho using uploadFile method, but unfortunately i got this :
"Unable to process your request. Please verify whether you have entered proper method name,parameter and parameter values."
$fields = array();
$fields['content'] = '#' . $content;
This process provided from zoho..
Please go to Setup-->Extensions & APIs-->APIs-->CRM API-->Click on Gear Icon-->Authentication Token Regeneration. Now, try to initiate an API call using the newly generated auth token.
Zoho forums Link : Zoho CRM->Zoho CRM Developer APIs
Edited :
Finally got solution :
Need to be change :-
$post['content'] = '#' . $content;
to
$post['content'] = new CurlFile($content);

Getting Transaction ID from Authorize.Net CIM API

I am creating a CIM API for authorize.net. I have it all working perfectly, but I need the transaction id to be returned to me when a transaction is created.
Right now, this what I have being returned when I complete a transaction:
if ($cim->isSuccessful())
{
$approval_code = $cim->getAuthCode();
}
// Print the results of the request
echo '<strong>Request Response Summary:</strong> ' .
$cim->getResponseSummary() . '';
echo '<strong>Approval code:</strong> ' . $approval_code;
Then this is the output I get: Request Response Summary: Response code: I00001 Message: Successful.Approval code: NXD8X7
No transaction ID is returned. I want to know how I can go about getting this. My goal is to write this to my database, but I need some way to get the transaction id. Thank you very much.
If you are using AuthorizeNet SDK you can get all response fields as an object with calling $response->getTransactionResponse function like following.
$request = new AuthorizeNetCIM();
$response = $request->createCustomerProfileTransaction('AuthCapture', $transaction);
$transactionResponse = $response->getTransactionResponse();
$transactionResponse->transaction_id

AS3 Flash api not setting game category app score - acces token error

Hope it's not a very noobish question i'm asking :) -
I'm trying to set the score parameter for my app ( Game category app ) with the AS3 Flash API ( Which i see is a wrapper around JS Api ) but i keep getting the "(#15) This method must be called with an app access_token" error, i've also tried a test call with the Graph API Explorer and the result is the same.( with generated acces token of the app and copy/pasted acces token )
I've searched the permission tables and i've set both publish_actions and user_games_activity for the authentification process.
Getting works perfectly ( i can receive basic information without any problems also score information but it's just an empty array probably because it isn't set ) posting seems to be the culprit
I want to know if i'm doing something wrong ( something like there's an additional auth process necessary on my server side )
If you guys have any ideea please help this is becoming very frustrating
Thanks in advance :D
Finally found the solution.
Here is the correct AS3 code:
var data:Object = new Object();
data.score = 285;
data.access_token = APP_ACCESS_TOKEN;
var requestType:String = "POST";
Facebook.api( Facebook.getAuthResponse().uid + "/scores/" , handlePostScoreComplete, data, requestType);
You MUST get the app access token using PHP or some other client-side SDK, not the Javascript SDK because it needs the app secret.
So in PHP you must get the access token and then you can pass it to Flash:
<?php
$APPLICATION_ID = YOUR_APP_ID;
$APPLICATION_SECRET = YOUR_APP_SECRET;
$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $APPLICATION_ID .
"&client_secret=" . $APPLICATION_SECRET .
"&grant_type=client_credentials";
$app_token = file_get_contents($token_url);
?>