i am new to laravel and having an issue regarding REST API over file processing,and i am using dingo laravel api
Here what i have done so for
$user = User::findOrFail($request->user_id);
$user->first_name = $request->first_name;
$user->avatar = $request->file('userfile');
if($user->save()){
return response()->json($user, 200);
}
How do i post a file or image from api and then store in upload folders physically ?
I am able to post data without file.
Any help will be highly appreciated.
Related
I am trying to upload an image, get the image hash for use in creating an adcreative using meta marketing api on google colab, but i keep getting an empty list, don't know why that keeps happening.
i have properly authenticated and i am able to post ad campaigns, adsets remotely but i am unable to upload and image or view list of existing images/hash
path = '/content/drive/Shareddrives/Design/sampleimage.png'
image = AdImage('act_5**********')
image[AdImage.Field.filename] = path
image.remote_create()
image_hash = image[AdImage.Field.hash]
print(image)
even when i try to read the existing adimages i also get an empty lsit.
FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)
my_account = AdAccount('act_5**********')
fields = ['id','hash','name','original_height','original_width']
images = my_account.get_ad_images(fields=fields)
images
try uploading your images as .bmp, .jpeg, or .gif:
I'm trying to create new DropboxPaper document in my account [email address redacted],
I'm use official Api and try to create file by "https://api.dropboxapi.com/2/paper/docs/create", the returned result is:
{
"error_summary": "insufficient_permissions/.",
"error": {
".tag": "insufficient_permissions"
}
}
Somebody know what's is wrong? Please help me)
[Cross-linking for reference: https://www.dropboxforum.com/t5/API-Support-Feedback/Paper-API-Create-Paper-Document/m-p/375961/highlight/true#M21093 ]
It sounds like you're probably using a new Dropbox account, so the Dropbox Paper functionality is only available in the Dropbox filesystem, and not via the legacy Paper API endpoints. You can find more information here:
https://www.dropbox.com/lp/developers/reference/paper-migration-guide
I am trying to understand how I should configure a web site (ASP.Net) that need to pass the user credential and get some mail things
I get different kind of errors depending on the app pool configure,
What is the complete way to do it? I mean code + Configuration ;o)
I don't want to write the user and password but get them through the windows authentication
Thanks
code:
Service = new ExchangeService(ExchangeVersion.Exchange2010_SP2)
{
Url =
new Uri(
"https://xxx/yyy.asmx"),
//UseDefaultCredentials = true doesnt help
};
var view = new ItemView(1820);
// Find the first email message in the Inbox that has attachments. This results
FindItemsResults<Item> results = Service.FindItems(folderName, view);
//Here I get the error 401
Take a look at Get started with EWS Managed API client applications, it covers the basics to get you up and rolling. Note that when you use UseDefaultCredentials, you have to be on a domain joined machine, with the user logged in, and you must be targeting an on-prem server. We tested that scenario out and the following code works in that scenario.
using System;
using Microsoft.Exchange.WebServices.Data;
namespace HelloWorld
{
class Program
{
static void Main()
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.UseDefaultCredentials = true;
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
//Replace the URL below with your own, but using AutoDiscover is recommended instead
service.Url = new Uri("https://computer.domain.contoso.com/EWS/Exchange.asmx");
FindItemsResults<Item> results = service.FindItems(WellKnownFolderName.Inbox,
new ItemView(1));
}
}
}
If that doesn't work for you, then you might want to try using impersonation. See this thread, where I think they've got a similar situation . More information about impersonation is on MSDN: Impersonation and EWS in Exchange.
i'm trying to learn how to get my own facebook & twitter wall status into flash so that I can export it out and install it in my iPhone.
After reading the facebook and twitter API documentation, I'm still very confussed on how to use them.
I'm very new to this and hope to get a suitable tutorial/sample code for some reference.
Help is appreciated. Thank you.
For Twitter it is easy. Just write the AS3 code to load the Twitter user RSS as XML. After that you will be able to use it.
var myXmlLoader:Loader = new Loader();
myXmlLoader.load(new URLRequest("http://twitter.com/statuses/user_timeline/#twitterUser.rss"));
// just replace "twitterUser" with your twitter user, leave all the rest as is
myXmlLoader.addEventListener(Event.COMPLETE, xmlLoadCompleted);
function xmlLoadComplete(evt){
var myWallData:XML = new XML(evt.target.data);
trace(myWallData); // you will get an RSS XML with the last 20 tweets from your account
}
To get an RSS from your Facebook wall you can use this:
https://www.facebook.com/feeds/page.php?id=23749877160&format=rss20
where 23749877160 is your Facebook account ID
that will give you an rss with your Facebook just as twitter does,
But you need some trick to load it with flash.
Locally you can load it and it works good using the same code to load the twitter,
but on the web your swf wont be able to load, some crossdomain issue.
To fix this what I did is a simple PHP file to load the rss and save a file with the loaded content.
PHP code:
<?php
set_time_limit(300); // this is to set the time limit to execute a code, is that the facebook wall take too long to load
$fbURL = "https://www.facebook.com/feeds/page.php?id=23749877160&format=rss20";
$fileName = "myFileName.xml"; // the name you want to do to your file, the file you will load with flash
$doc = new DOMDocument();
if($doc->load( $fbURL )){
$doc->save($fileName); // saving file in server folder
}else{
echo "error";
}
?>
This is cool but you need to execute the PHP file before intent to load the generated XML. you can use this code to do the trick
AS3 code:
var myPHPLoader:Loader = new Loader();
myPHPLoader.load(new URLRequest("xmlGenerator.xml"));
myPHPLoader.addEventListener(Event.COMPLETE, phpLoaded);
function phpLoaded(evt){
trace("PHP executed");
// do whatever you want
// after the php is executed you can load the fbXml generated normally
}
This works good, but keep in mind that the twitter rss and Facebook RSS, has a call limit per hour (150 call) for twitter, for Facebook I dont know. so if your app reach that limit before complete the hour it will call the empty xml or an error.
dont worry for Facebook in this example you have an PHP that will save the file just if it loads good, if the PHP dont loads the Facebook wall then it wont save the file, so your app will load the old fbXml.
Use the same php to load the twitter rss and save a file to be loaded from your flash app.
What I did is the follow.
PHP Code:
<?php
function savePlainRss($loadURL, $fileName){
set_time_limit(300);
$doc = new DOMDocument();
if($doc->load( $loadURL)){
$doc->save($fileName);
}
}
savePlainRss("https://www.facebook.com/feeds/page.php?id=23749877160&format=rss20", "myFacebookWall.xml");
savePlainRss("http://twitter.com/statuses/user_timeline/#twitterUser.rss", "myTwitterRSS.xml");
?>
This code will save an XML file for twitter rss and Facebook Wall but just if it can load it, if dont it will keep the old file.
Then from flash load the generated XML files.
For me to be sure my app wont reach the call limit and avoid twitter or facebook tag my app as spam, I did a cronjob on my Server to execute the PHP file
each 15 minutes so the calls to twitter and Facebook per hour is just 4, you can find help in google about how to do a cronjob, some hosting and web server have tools to do it.
you can do de calls each 5 minutes if you want more frequently updates or less, but keep in mind that the facebook load can take a long time, up to 300 seconds (5 minutes) dond use less than that to be sure you will have the complete work done.
Thanks for reading.
I hope it helps :)
had alook at it: http://developers.facebook.com/docs/guides/web/ look here for the API.
i dont want to post there code on here...
Also heres seems to have more info:
http://facebook-actionscript-api.googlecode.com/svn/release/current/docs/index.html
this is successful with actionScript, i learned something new
if i got time i will create a basic user status or something and let you know, for now i hoped i pushed you in the right direction.
I am writing a web application using c#.net 4.0 to read post in a specific Facebook page.
E.g. http://www.facebook.com/pages/Public-Service-Association/164106710269112
I used Facebook C# SDK from http://github.com/facebook/csharp-sdk/
Please help me to read the posts using above SDK?
Thanks.
After you follow the tutorial, after you declare a JSON for your results, simple get their Profile Feed:
Facebook.FacebookAPI api = new Facebook.FacebookAPI(token); //place your access token
JSONObject result = api.Get(#"/nzpsa/feed");