Magento API Data Type: CartCustomerEntity - api

While trying to create a cart via the Magento API, I am having trouble adding an existing user as the owner of the cart. I am working with the documentation they provide here:
http://www.magentocommerce.com/wiki/doc/webservices-api/api/cart#cart_customer.set
I called "customer.info" using my specific customerId, then just passed the results to that cart_customer.set method, praying that was what it was asking for. It returned (from PHP)
Fatal error: Uncaught SoapFault exception: [1045] Customer's mode is unknown in ...
I looked at the example at the bottom of the above referenced page and they only had an example for a new guest user, 'mode' set to 'guest'. I was wondering if anyone knew what the other options were for that 'mode' key? Documentation on that data structure in general would be a great help.
Thanks.

Via my own comment:
Ah ha! Found buried in their forum:
$customer = array( 'entity_id' => 6, 'mode' => 'customer' ); via http://www.magentocommerce.com/boards/viewthread/232778 I guess that is all you need to pass. This isn't really a great explanation but it does solve the original problem.
Just gonna flag this one as done.

Related

Get workspace details in podio api

Is there any way to get work space name and URL if the API request is authenticated as app.
Podio::authenticate_with_app($app_id, $app_token);
PodioSpace::get($space_id);
the above code return PodioForbiddenError
Sorry, but the I don't think this is allowed within the scope hierarchy.
Please refer to https://developers.podio.com/authentication/scopes
But, if you only need space name, id, url and couple of other minor details you could still get it by using fields parameter. This is described here: https://developers.podio.com/index/api (scroll down to the end of page).
Here is how I debug it with Ruby:
Podio.client.authenticate_with_app(<app_id>, <app_token>)
app = Podio::Application.find(app_id, {'fields' => 'space.view(full)'})
puts app['space']['name']
puts app['space']['space_id']
puts app['space']['url']

Authentication user provider is not defined in laravel

Based on this Can anyone explain Laravel 5.2 Multi Auth with example
i will like to implement custom authentication on my app for the admin and users section but the whole concept is confusing maybe it is new to me in laravel 5.2 (my version) but at this stage i can say if i am getting it right or wrong but this is the error that is displaying.
InvalidArgumentException in CreatesUserProviders.php line 40:
Authentication user provider [] is not defined.
so i have done what #imrealashu answered but still i have issues.
It means that you didn't pass the guard like this:
auth('admin')->user();
//or
Auth::guard('admin')->user();
Or when you call the middleware auth in your controller, you need to pass the guard:
$this->middleware('auth:admin');
This video explains it https://www.youtube.com/watch?v=Vxh2ikaydfo (In spanish but its understandable )
I got that error when I tried to change in auth.php:
'provider' => 'users'
to
'provider' => 'user'
because my database table was user, not users.
That's not necessary. I just had to add to the User Eloquent class:
protected $table = 'user';

Is there a programmatic interface for retrieving/exporting Report results from Salesforce?

I am trying to retrieve the results of a Salesforce Report programmatically.
Often referenced is this blog about scraping the results from the web side, but the method is unsupported: http://sfdc-heretic.warped-minds.com/2006/04/10/progmatic-access-to-salesforcecom-reports/.
I can get a list of reports via the REST api:
require 'restforce'
restforce_client = Restforce.new(
:refresh_token => <refresh token>,
:client_id => <client id>,
:client_secret => <client secret>
)
reports = restforce.query("SELECT Id,DeveloperName FROM Report")
reports.last.DeveloperName
=> "Rob_Test_Report"
I've also tried retrieving via the Metadata SOAP API ReportFolder object:
require 'metaforce'
metaforce = Metaforce.new(
:username => <username>,
:password => <password>,
:security_token => <security token>
)
report_folders = metaforce.list_metadata('ReportFolder')
report_folders.last.full_name
=> "RobTestReportFolder"
I can see the folder. I haven't retrieved the contents yet but even when I do it seems that I would just be getting the metadata around the report itself (i.e. the filter criteria), not the results of the report. The metadata api is discussed here: https://success.salesforce.com/questiondetail?qId=a1X30000000IQ8pEAG. Is this correct?
I saw this similar question from a couple years ago but did not know if it was correct or anything had changed in the API:
How to I access reports programmatically in SalesForce using Apex
Is it possible to export or pull the results of a Report through a supported Salesforce API?
You cannot retrieve the results of a report without using the Analytics API, which as of the Summer '13 release will be available only as a pilot. If you want to participate in the pilot, let me know and I will submit your request.
Once in the Pilot, you use a REST endpoint passing in the Id of the report. You will have two endpoints-- a describereport endpoint and a runreport enndpoint. What is returned from describeReport is a JSON representation of the metadata for the report (describes the dimensions and facts and such) and from runReport a JSON representation of the data.
Once you have the data you can do with it what you will. The report data is only available at the summary level and for the pilot only summary and matrix reports are supported.
I'm not aware of any programmatic way to do that. Conga app could be one option but I believe they get the filters from the report's metadata and construct a matching SOQL query...
The blog post you've mentioned should work. You probably missing something like setting session id in cookie.
Hack, error-prone, web-scraping way would be to use something similar to trick I did with Apex: https://salesforce.stackexchange.com/questions/4303/scheduled-reports-as-attachment. Theoretically you'd be able to pull off similar thing from any other API access as long as you have the user's session Id (whether passed from logged in session or generated yourself from SOAP login call...)
Do also check out metadaddy's answer to my related question: https://salesforce.stackexchange.com/questions/4692/screen-scrape-salesforce-with-rest-get-call-from-apex

How Can i share a post using the post id

I am using Koala gem and in my UI i have an share link. How can i share the posts using the post id. Can it be done like this.
#facebook = FacebookToken.first
#graph = Koala::Facebook::API.new(#facebook.access_token)
#graph.put_object(params[:post_id], "share",:message => "First!")
It gives the following error
Koala::Facebook::ClientError: type: OAuthException, code: 240, message: (#240) Requires a valid user is specified (either via the session or via the API parameter for specifying the user. [HTTP 403]
I thing something going wrong with permission. I have added the following permission in the fave bool app
"share_item,manage_pages,publish_stream,read_stream,offline_access,create_event,read_insights, manage_notifications"
Do I need to some other permission to share a post using post id
The first parameter in put_object is not the post ID, but the ID of who is sharing it, be it a page or user.
So instead of saying:
#graph.put_object(params[:post_id] ...
You would say:
//the current user
#graph.put_object('me' ...
or
//any user that you have a UID for
#graph.put_object(#user.uid ...
or
//a page that you have post permissions for
#graph.put_object(#facebook_page.id ...
Also in a future version of Koala, put_object will be a bit different, and you should go ahead and switch over to put_connection.

SugarCRM: Getting "Invalid Session ID" error with REST calls

I'm using SugarCRM CE 6.0.3.
When I make REST API calls like get_entry_list(), I always get this error:
{'description': 'The session ID is invalid',
'name': 'Invalid Session ID',
'number': 11}
I am very sure that I am logged in and using the correct session ID. In fact, when I can successfully call get_user_id() and retrieve my own user ID.
Googling has not produced any helpful results, anyone else encountered this problem?
I have found the problem, it is really just a matter of bad documentation on SugarCRM's part. The parameter naming is all wrong in this document:
http://developers.sugarcrm.com/docs/OS/6.0/-docs-Developer_Guides-Sugar_Developer_Guide_6.0-Chapter%202%20Application%20Framework.html#9000259
Simple fix for this problem: Do not use named parameters when making REST calls in SugarCRM. i.e. Use positional parameters (JSON array) for 'rest_data' in API calls.
I encountered this issue with the set_entry api call. For me the issue is one of the values that I was submitting to the call contained special characters that the api couldn't handle. My solution was to urlencode the value, and Sugar decodes it on their end. See below:
$name = "abc's ; 10/10/2013";
$values = array(
"name"=>$name
);
$sugar->set_entry("Accounts", $values);
The above threw the Invalid session ID error. Below is the code that works:
$name = urlencode("abc's ; 10/10/2013");
$values = array(
"name"=>$name
);
$sugar->set_entry("Accounts", $values);