Different companies listed in Exact Online REST API system divisions and XML API Administrations - exact-online

When I download the list of companies using the end point Administrations either through the user front end or directly using a HTTP GET, I receive an XML with contents such as:
<?xml version="1.0" encoding="UTF-8"?>
<eExact xsi:...>
<Administrations>
<Administration>
...
</Administration>
I can receive the list of companies also using the REST API system/divisions.
In general the number and names companies listed in both are equal, although some fields are present in XML API that are not present in the REST API and vice versa.
However, sometimes the contents are different. For instance, today I had scenario where there were only 2 companies listed in the XML topic, but over 900 in system/divisions.
This occurs both using the APIs directly as through Invantive SQL.
Why is the outcome different?

You can also use one of the four views:
AllAdministrations (similar to Administrations)
AllAdministrationCustomers (-)
AllAdministrationClassifications (similar to AdministrationClassifications)
AllAdministrationAssignedTypes (similar to AdministrationAssignedTypes)
These query the administrations across all subscriptions an accountant has access too.

All topic are read using a specific company (in the URL named division) to retrieve the data from.
System/divisions REST API returns ALL companies accessible for the current user, so the outcome does not depend on the division used in the URL request.
However, the XML topic Administrations returns ONLY companies accessible for the current user that are of the SAME customer account of the division used in the URL request.
A customer account is number of 1 or more companies which is independently billed. For entrepreneur licenses, this is generally the same list of companies.
However, for an accountant it differs what company is used, since they may have hundreds of different customers each with their own licenses plus many companies under their own customer code.
In general, it is more wise to use the system/divisions.
However, when you need additional fields or for instance the classifications of a company, you will need to use the XML API. The easiest way to determine the minimum number of companies to retrieve the XML API Administrations data for is to:
First retrieve all system/divisions.
For every different value of customercode, find one division, for instance the minimum value.
For each of these divisions, access the end point Administrations.
Combine the output of each of those.

Related

Batch Processing - Odata

I want to make requests to allow grouping of multiple operations into a single HTTP request payload
I have an API Key that allows me to make Get Requests and return tables in a Database as JSON blocks. Certain attributes are 'expandable' and OData (Open Data Protocol) allows you to 'expand' multiple attributes within the "CompanyA" table (ie Marketing, Sales, HR)
http://api.blahblah.com/odata/CompanyA?apikey=b8blachblahblachc&$expand=Marketing,Sales,HR
I would like to select multiple tables, (the request above only contains 1 table which was Company A) and understand this is possible via "Batch Requests"
https://www.odata.org/documentation/odata-version-3-0/batch-processing/
The documentation above alongside Microsoft's is hard to translate into my noted desire.
I wanted it to be as simple as, but I know it is not and can't figure out how to get there:
http://api.blahblah.com/odata/CompanyA,CompanyB,CompanyC?apikey=b8blachblahblachc
The end goal is to have one JSON file that contains detail about each table in the DB , rather than have to write each individual query and save it file as below:
http://api.blahblah.com/odata/CompanyA?apikey=b8blachblahblachc
http://api.blahblah.com/odata/CompanyB?apikey=b8blachblahblachc
http://api.blahblah.com/odata/CompanyC?apikey=b8blachblahblachc

Why An Address Data Is An Entity?

I always think that an address data is a value object since it is immutable and its equality is defined by the same data in all fields. For example, a billing address in a part of a payment and a shipping address is a part of an order or a fulfillment. When someone changes her/his address, a new address data is needed. But, every single sample code/application, I have run into, has an address data as an entity, which its DB table has its own ID. It would make a sense if a system wants to keep track of all addresses where all business activities/events occur. I, however, don't see such intention in those sample code/application. Do I miss something in the regard?
You can't generalize.
Examples are one thing, real world problems are another. You can't say that for all projects one solution fits it all.
I'll give you an example I had in a project conserning aggregate roots.
Logically and legally a subsidiary is an extension of its company, eg. Walmart has its HQ with tax number and everything and subsidiaries without tax number where the actual stuff is sold. Logically, for applying to a goverment funding or something similar, the HQ sends a request for its subsidiary. Here, Walmart HQ is an aggregate root and its subsidiary is a part of an aggregate in funding procedures.
This is a logical example.
What I had is that a subsidiary can legally apply for state funding without the knowledge of HQ! Therefor, HQ is not an aggregate root anymore, but a subsidiary is. It was extremely illogical, but those were the business requirements.
The point is the same with your value object question. Although you can use Address as an example that it is an entity or a value object, it is the requirements of the business that dictate what an address is, and not what is logical.
Pre-note: there are domains where an address should be an entity, like a mail service; we do not talk about those domains
From my experience, people tend to implement an address as an entity because of the persistence: it is easier to persist an address as a sub-entity to a relational database than to persist a value object because of the entities ID that act as primary keys in the storage table.
However, there are tactics that permit storing a value object as an database entity but still using it just as a value object, as it should be. Vaughn Vernon shows how to do this in his book, Chapter 6, sub-chapter Persisting Value Objects.

Advanced targeting like Facebook Sharings (Flexible ACL) DB Design

I've been trying to develop an internal staff portal for our company. There are departments, job grades, working areas, roles (user, editor, admin, super admin, etc...) and special groups (executives, etc) for user grouping.
User must have one (only one) department.
User must have one (only one) job grades.
User must work in minimum one area.
User must have one (only one) roles.
User may have one or more special groups.
Job grades and roles are hierarchical (an grade or role may be inherited of another one) but other ones not.
Users will see only allowed menus and access permitted routes.
User will also select which users can view it when posting a new content.
e.g:
Combination 1: (IT or Finance department) and (Job Grade is one of 9,10,11) and (Area is one of 1,5,8) and (Exclusive special group is one of 1,5,8) except user id=1
Combination 2: (HR department) and (Job Grade is 11) and user_id=3,4,5
Combinations can be related as AND/OR among themselves like Combination 1 AND combination 2
So, there will be lots of contents and every content will have different group permissions. I try to create a DB schema but it's very hard to get all contents that is visible to logged in user. Serialized data would be good for saving combination sets in db but it looks like impossible with serialized data. Is there an advantage to using MongoDB for this issue? How can i save combinations of group/user permissions in tables also?
I researched lots of ACL and RBAC examples but can't find the optimal solution. Please help.
Btw, i use Laravel Framework.
Thanks.
You need to look into attribute-based access control (ABAC - Wikipedia) and the eXtensible Access Control Markup Language (XACML). NIST, the National Institute of Science & Technology gives a great intro to ABAC here.
XACML will give you the ability to express fine-grained access control policies that use you attributes. In your question you have:
user attributes
department
job grade
working area
role
group
object (resource) attributes
content type
content location
content classification
With XACML you can write rules such as:
A user with grade==1 can do the action==edit on content of type==post
if content.department==user.department.
You can have as many rules as you like including conflicting rules or environment rules (deny access before 9am).
Have a look at the ALFA plugin for Eclipse to write your own policies (Wikipedia | Download).
HTH,
David

How do we know a survey_id to be able to call the API?

The API calls require a survey_id.
There is a surveyID in the web link but that is an alphanumeric code that is not the same as the survey_id. eg https://www.surveymonkey.com/s/STB97HW is surveyID 47481373
The "Edit survey" pages do not show the surveyID. (by the way, I've just found that the category eg "Just for fun" is another one of those survey attributes not returned by get_survey_details)
So a user can not make a note of the surveyID for later querying.
A user can download a CSV file of data, as a pair of "Sheet_1.csv" and "Collectors.csv" but neither of those files contain a surveyID. It would be a useful enhancement if, given a data CSV download, one could query the surveys list to find the one that has a given CollectorID.
The user could copy the survey title into a query and search the survey list for ones that match, assuming they copy it correctly or spell it correctly if entering it. Or the query could be by a date range, to get a list of surveys, present them to the user, and ask them to pick the one they want.
Is there no way that a user can discover a surveyID, either when designing the survey or when it is closed, in order to uniquely specify it for retrieval without having to go through this search process?
You need to use the "get_survey_list" API to get a list of survey ids, you can then feed these into the other API methods.
Note that a survey link is actually an individual collector for that survey, and not directly associated with a survey - i.e. it is associated with a collector, which is then associated with a survey. You can have multiple links (or collection methods) for one survey that way. You can get a list of collectors for a given survey using get_collector_list. get_collector_list can also return the list of URL links for these collectors, if they exist.
There is currently no way to get a survey_id without going through this method - these survey ids are not meant to be visible to the end user, usually for API integrations a list of the user's surveys is presented to them (via the get_survey_list method) and then they select one. If you're interested, have a look at Mailchimp, Zendesk or Hootsuite's integrations.

Where does aggregated data fit in in a REST JSON API and a mobile client?

I have an iOS app talking with a REST JSON API. I have mapped the model resources 1-1 with the controllers/endpoints in the API. E.g. User (/users), Friendship (/friendships), Rating (/ratings), RatedObject (/rated_objects) etc. And on the device I'm using RestKit/CoreDate to store/sync all objects.
Now I start to get the need for different kind of aggregated data, e.g. different rating averages and rating counts on the RatedObject depending on the friendship type. I have solved it now by adding the data to the RatedObject type:
RatedObject
name
size
ratingAverageFromCloseFriends
ratingCountFromCloseFriends
ratingAverageFromFamily
ratingCountFromFamily
ratingAverageFromAllFriends
ratingCountFromAllFriends
But when it starts to get more kinds of aggregated data on different kind of objects, it is getting over hand. And I also sometimes need to get the average from only one specific friend, and that can't be added to the model.
I store all data locally on the iOS device, and the aggregated data should be easy to update from the server.
How should I solve this and make it easy and natural for both the client and the server?