SugarCRM API Query - getting Access Denied? - sugarcrm

I am running SugarCRM 6.5.x and using the SOAP API. What I am trying to achieve is lookup an Account by checking the value of a custom field with the company registration number like this:
get_entry_list(...
accounts.id in (select id_c from accounts_cstm join accounts on accounts_cstm.id_c = accounts.id where accounts_cstm.company_number__c = '12345678')
... )
I keep getting access denied errors and I don't understand why? If I run the query in phpmyadmin it works fine? How can I make this work for SugarCRM?

Support for subqueries like that in our Web Services API is removed as of Sugar 6.4, with certain exceptions; see this post for more details...
http://developer.sugarcrm.com/2012/03/19/howto-avoiding-subqueries-with-our-web-services/
For this one, you shouldn't need to do the subquery as the cstm is joined in automatically.

Are you sure that you opened a session and send the right parameters?
get_entry_list($session, $module_name, $query, $order_by,$offset, $select_fields, $link_name_to_fields_array, $max_results, $deleted )
Take a look at the API Description and search for "Call: get_entry_list()".
It's for 6.4 but shouldn't make any difference.

Related

"s:Client: Not Allowed List" error when running Loket.nl query

For one customer site, the following query:
select /*+ ods(false) */ *
from Werkgevers#loket wgr
join PersonenPerWerkgever(wgr.entryid)#loket psn
join WerknemerVerloningsrunsPerPersoon(wgr.entryid)#loket wvn
returns an error with message code "s:Client" and text "Not Allowed List".
I seem unable to find any documentation on this loket.nl error with Invantive SQL. How can I fix it?
This error is typically caused by missing privileges. The text is not very well formulated, but you will have to live with it since Loket is focusing on adding a new REST-based API platform.
Make sure your user has sufficient privileges.

Facebook Marketing API: Is it possible to filter insights by status

I am trying to filter adsets insights by adset status, but when I add a status filter, I get an empty dataset back:
curl "https://graph.facebook.com/v2.7/act_<redacted>/insights?fields=clicks,impressions,cpc,ctr,account_id&time_range%5Bsince%5D=2016-01-12&time_range%5Buntil%5D=2016-09-12&access_token=<redacted>&format=json&filtering=%5B%7B%22field%22:%22status%22,%22operator%22:%22EQUAL%22,%22value%22:%22ACTIVE%22%7D%5D&level=adset"
here is what filtering param looks like before it gets url-encoded:
[{"field":"status","operator":"EQUAL","value":"ACTIVE"}]
I have tried all valid values for status ACTIVE, PAUSED, DELETED, ARCHIVED to no avail.
When I remove filtering param - I see my data.
The question is:
Does anyone know if it is possible to filter by status, and if it is, what I am doing wrong?
It is possible. Using latest version as of March 2018.
You need to actually request all the ads that are ACTIVE and then provide insights as a 'nested' list of fields.
Replace 123456 with your ad account (but leave the 'act_' which is needed)
act_123456/ads?fields=effective_status,name,insights{total_action_value,total_actions,actions},adset_id,campaign_id&filtering=[{'field':'effective_status','operator':'IN','value':['ACTIVE']}]
This also works for /campaigns and /adsets
You can also do this (be sure to include &level=ad):
act_123456/insights?fields=ad_id,adset_id,campaign_name,action_values,campaign_id,total_action_value&level=ad&filtering=[{"field":"campaign.delivery_info","operator":"IN","value":["active"]}]
Filtering by insights isn't possible. At least in v2.7. To get insights for let's say ads I've decided to do the following:
1. Fetch ads that I need via /ads call. This allows me to filter by status.
2. Fetch insights for the same collection of ads and make sure that I ad id is included in the response.
3. Filter the second collection using the first one.
i m using this to filter campaigns with insights , working for me , start playing with it
'filtering'=>
array(
array(
"field"=>"campaign.effective_status",
"operator"=>"IN",
"value"=>$campaigncheckstatus,
),
),
$campaigncheckstatus = array("ACTIVE","PAUSED");
dont forget to json_encode $campaigncheckstatus if passed through url

Unable to search for Orders/Customers in oracle commerce (ATG) - CSC 11.1

I am trying to perform order and profile search operations on CSC, but they return no results.
I the components /atg/commerce/textsearch/OrderOutputConfig/ and /atg/userprofiling/textsearch/ProfileOutputConfig/ and I found them indexing perfectly in the tables SRCH_ORDER_TOKENS and SRCH_PROFILE_TOKENS respectively.
After enabling loggingDebug in both components I found that the search query has additional condition seems that it's related to multisite pfrmZeroRealmsAccessible, however I found that all tokens stored in DB for orders and customers have this value pfrmdft. Below is the query extracted from logs:
[++SQLQuery++]
SELECT t1.id
FROM srch_order_tokens t1
WHERE CONTAINS(t1.tokens,?,0) > 0
-- Parameters --
p[1] = {pd: tokens} pflnAhmad% AND pfrmZeroRealmsAccessible% (java.lang.String)
[--SQLQuery--]
Note: My application has only one single site (not multisite) however I found some configuration files created by CIM related to multisite which I can't remove.
Please help me answering the following question:
Is this issue really related to multisite configuration and how can I fix this problem in orders and customers search?
In Oracle commerce 11.1 how can I disable working with multisite?
Thanks
If you have not configured multi site then you need change the property "siteAccessControlOn" to false in the below component
/atg/commerce/custsvc/environment/CSREnvironmentTools/
for more details you can get back to the below oracle docs link
http://docs.oracle.com/cd/E52191_01/Service.11-1/ATGCommerceServiceCenterInstall/html/s1203controllingsiteaccess01.html

Use Facebook API to list group members' join date and inviter

I can use the Facebook Graph API to get a list of group members. The simplest way to do this is to go to the Graph API Explorer and do a GET request of the form {group_id}/members. Is there a way to similarly obtain the members' join date and who they were invited by?
The relevant Graph API doc doesn't seem to mention it. But I know the information is stored by Facebook because it is possible to list all of the group members and their inviters through Facebook itself. Is there a way to get this information through the API?
EDIT: Nothing in the FQL group or group_member API either.
While this information is not available on the API, you can get it by using Selenium to scrape the members page.
First, instantiate a driver and use it to get the members page:
driver.gethttps://www.facebook.com/groups/your group number/members
Then, look for the member information:
containers = driver.find_elements_by_tag_name('td')
Finally, iterate through the web elements, extracting text and parsing resulting list for joined date information:
member_info = container.text.split('\n')
name = member_info[0]
member_since = member_info[-1]
You'll still have to map this information to the user ids, which you can do by looking for another element in the container and using REGEX.
`def parse_id(self, container, name):
hovercard = container.find_element_by_link_text(name).get_attribute('data-hovercard')
regex_id = re.compile('php\?id=(\d*)')
member_id = regex_id.search(hovercard).group(1)
return member_id`
It is indeed stored by Facebook and retrieved for use with internal APIs. For the Graph API however it is not possible to get this information.
All the fields available for a group_member are listed at SELECT column_name FROM column WHERE table_name = "group_member"

Laravel 4 rest api non-implicit action routing and left join

I am pretty new to Laravel but I certainly like Laravel 4. I am stuck at two points -
The first is that - I have a non crud action method in a controller that has to do a left join with two tables and return the result. There are two tables, Employees and Departments. I am trying to get all assigned and non-assigned employees for creating an association between them. This action method is inside "EmployeeController". It is named as "allAssignedEmployees". I tried the following routing but seems it doesn't work :
Route::resource('employees/assignedEmployees/{deptId}', 'EmployeesController#assignedEmployees');
Secondly, I am not kind of too sure about my left join. The following is what I made out of googling
$unassignedEmployees = DB::table('employee')
->join('department', function($join)
{
$join->on('department.employee_id', '=', 'employee.id');
})
->where('department.id', '=', $deptId)
->get();
Apparently what I wanted in SQL is - select * from employee emp left join department dept on dept.employee_id = employee.id and employee.dept_id = 2
The other related questions unanswered I had in mind are - how to log in Laravel 4? Especially SQL queries or general log statements. Is there an inbuilt logging support.
I know its a lot of questions, but I am sure the answers will help my learning process hence thanks for your time.
First I'm not being rude but you should have studied Documentation First at least.
Now coming to your questions:
About Resource Controller:
Route::resource('employees', 'EmployeesController');
This single route declaration creates multiple routes to handle a variety of RESTful actions on the employees resource. Likewise, the generated controller will already have stubbed methods for each of these actions with notes informing you which URIs and verbs they handle.
Actions Handled By Resource Controller
Verb Path Action Route Name
GET /employees index employees.index
GET /employees/create create employees.create
POST /employees store employees.store
GET /employees/{id} show employees.show
GET /employees/{id}/edit edit employees.edit
PUT/PATCH /employees/{id} update employees.update
DELETE /employees/{id} destroy employees.destroy
So if you have created resource controller then get routes like employees/{id} will be handled by controllers show method.
But if you want specific method to handle then you have to route it like this
Route::get('employees/assignedEmployees/{deptId}',''EmployeesController#assignedEmployees'');
And regarding logging read here