Using the blog/{blog-host}/post API call in the v2 oAuth API in order to post a photo, I have a problem with specifying the "source" for the image. The API dictates that this parameter should be the source to an image:
http://www.tumblr.com/docs/en/api/v2#posting
I am using an image on my server, such as this one. The Facebook and other APIs accept and process it correctly:
http://streamified.me/p/d4xh6o/
Unfortunately, I get the following response from Tumblr:
meta = {
msg = "Bad Request";
status = 400;
};
response = {
errors = (
"Error uploading photo."
);
};
Posting other status types works fine...
Well, it looks like I solved the problem. My server was serving the image (the above URL) via a PHP script. Even though the header data etc. was properly sent and the image showed fine in all browsers, the Tumblr API was not recognizing it as an image. Redirecting to a .jpg URL worked fine.
I'd consider this to be a bug in the Tumblr API, but the workaround is "good enough" for me.
Related
I'm trying to upload an image as profile picture using WhatsApp Cloud API *.
After creating an application using WhatsApp Cloud API I'm not allowed to access neither using the regular application nor using Business Application. It says something like "try again in one hour". So I have to implement everything using the API.
After reading the docs and importing Postman Endpoints I found the one called Business Profiles > Update Business Profile
https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/whatsapp_business_profile
It has a field "profile_picture_url"and I have tried POSTing media https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/media and then with the given ID y used https://graph.facebook.com/{{Version}}/{{Media-ID}} to get the URL but it didn't work. The rest of the information is updated successfully
{
"messaging_product": "whatsapp",
"address": "",
"description": "Simple Bot",
"email": "...#gmail.com",
"websites": [
"https://..."
],
"profile_picture_url": "https://lookaside.fbsbx.com/..."
}
However if I try to send someone using the ID and the endpoint https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/messages it works fine.
And if I use Download Media Content with the URL in Postman it works fine too.
I don't know if I have misunderstood something or if it can't be done using the API.
It is mentioned in the Cloud API Documentation:
profile_picture_url (Optional): URL of the profile picture generated from a call to the Resumable Upload API.
But, i got it working using profile_picture_handle instead of profile_picture_url. So how do we get the profile_picture_handle?
Prerequisite:
Graph API token here. Or use your WhatsApp Cloud API token.
App ID, go Apps > Your App > Settings (sidebar menu) > Basic
Update Photo Profile:
Call POST https://graph.facebook.com/v14.0/{{appId}}/uploads?access_token={{token}}&file_length={{fileSizeInByte}}&file_type=image/jpeg
Save the session id you got, upload:XXXXXX?sig=XXXXXX.
Call POST https://graph.facebook.com/v14.0/{{sessionId}}, with the headers: Authorization=OAuth {{token}}, file_offset=0, Host=graph.facebook.com, Connection=close, Content-Type=multipart/form-data, and include your image file in the request body with type binary. If you using Postman, see image below (This is what I missed for hours).
Save the handle result you got, 4::XXX==:XXXXXX.
Finally, call POST https://graph.facebook.com/{{Version}}/{{Phone-Number-ID}}/whatsapp_business_profile, with json request body: {"messaging_product": "whatsapp", "profile_picture_handle": "4::XXX==:XXXXXX"}
That's it, You can check the profile picture.
The last step you have to add your taken by selecting "Bearer" or else it will give you error. I had hard time on the last ones, do all the steps and then go to the following link and it should help.
https://web.postman.co/workspace/My-Workspace~a4ddb3b8-02a3-4132-8384-66e63e149b7b/request/22958165-506a0542-c845-41ac-b3fb-b8209fd6f53b
I'm new to Microsoft Text Translator API, however after followed all instructions I found I always get "no content" from the text translator API.
Here is what I did:
I created subscription to microsoft translator text API (S1 Standard tier "Pay as you go") on azure and obtained key from it (key1).
I got access token from key1 using the tool here http ://docs.microsofttranslator.com/oauth-token.html.
Then I tried Translate API on http://docs.microsofttranslator.com/text-translate.html#!/default/get_Translate. The parameters I provided are
Text : 彼はジャッカスです。 (This is the example in the same page)
To : en
Authorization : Bear [Access token]
However when I clicked "Try it out!" button, I always get
Response Body : no content
Response Code : 0
Response Headers : {"error" : "no response from server"}
the Request URL is : https://api.microsofttranslator.com/v2/http.svc/Translate?text=%E5%BD%BC%E3%81%AF%E3%82%B8%E3%83%A3%E3%83%83%E3%82%AB%E3%82%B9%E3%81%A7%E3%81%99%E3%80%82&to=en
I suppose this is a "hello world" sample which should work, however it doesn't. Please let me know if there is anything wrong here, and how I can get it work.
Thanks!
Looks like there is something wrong with the documentation page at the moment. You can use other tools like Postman to try out the API. I just tried and it works fine.
I'm working with the google-api-php-client Library for Google Drive (LIBVER = "1.0.5-beta") and when I issue this:
$permission = new Google_Service_Drive_Permission();
$permission->setType('user');
$permission->setValue($email);
$permission->setRole($role);
$service->permissions->insert($folder_id, $permission, array('sendNotificationEmails'=>false));
I get a Bad Request 400 error back.
With all the same settings, if I remove the sendNotificationEmails option, it works fine. The client library does not seem to be doing much more than appending that as a querystring value to the POST request, so could it be a bug in the API?
This is very strange. The request to /tags/chiara8anos/media/recent is working fine.
The problem is that the profile is public (http://instagram.com/chiaratroccoli) and i can fetch all images except this http://instagram.com/p/fYtRx0Qvit/.
The API is not returning this specific post but the hashtag, #chiara8anos, is correctly there as you can see. So the request /tags/chiara8anos/media/recent should have this.
I noticed that the image is not on amazon bucket as is use to be. This specific image is here: http://distilleryimage9.ak.instagram.com/4852dfbc339711e3817122000ab5bea8_8.jpg
If you try to use api-console (http://instagram.com/developer/api-console/) with this request https://api.instagram.com/v1/tags/chiara8anos/media/recent you won't be able to fetch this post even paginating.
Is it a bug? Some limitation from Instagram?
If you check the /users endpoint, that image is returned correctly and has standard_resolution: http://distilleryimage9.s3.amazonaws.com/4852dfbc339711e3817122000ab5bea8_8.jpg
which is the usual AmazonAWS URL This is the endpoint: https://api.instagram.com/v1/users/605729285/media/recent?access_token=
But you are right saying that the image is not returned using the /tags endpoint. It looks like an Instagram bug to me.
I am working on a project using the Youtube APIv2.
I am using the API through Zend Framework via Zend Gdata.
My application is querying the youtube api, getting a video feed then for each entry getting the name, thumbs, views, duration and tags for each video entry.
As announced by Google (http://apiblog.youtube.com/2012/08/video-tags-just-for-uploaders.html) now to get the video tags of each video entry the youtube api request as to be authenticated by the user that owns the videos on youtube in order to retrieve these video tags.
What i've done is simply adding a developer key and a httpClient object when I init the *Zend_Gdata_YouTube* object, like that :
$developerKey = 'mydevkey';$authenticationURL = 'https://www.google.com/youtube/accounts/ClientLogin';$idApplication = 'my_app_id';$idClient = null;$httpClient = Zend_Gdata_ClientLogin::getHttpClient( $username = 'google_account_email', $password = 'google_account_pass', $service = 'youtube', $client = null, $source = 'my_app', $loginToken = null, $loginCaptcha = null, $authenticationURL);$this->yt = new Zend_Gdata_YouTube($httpClient, $idApplication, $idClient , $developerKey);$this->yt->setMajorProtocolVersion(2);
I tested this piece of code in my project locally inside Mamp Pro and it works perfectly fine, retreiving the video tags as it should be, meaning that the code works.
My problem starts when i wan to put my code on my production server, the *Zend_Gdata_ClientLogin::getHttpClient* object is not working and keeps giving me the error code "Authentication with Google failed. Reason: BadAuthentication"
I checked if someone else was having my problem and i came to this article "http://apiblog.youtube.com/2011/03/clientlogin-fail.html", but neither of the 4 scenarios are similar to my problems.
Could someone help me ? Does my production server is missing something in terms of modules or authorizations (i check it doesn't looks like it).
Thank you.
I had the same problem. My script was working locally, but not in production.
Change your password for a new one and run your script in production first.