How can I retrieve the list of permissions assigned to a Sight (Dashboard)? - smartsheet-api

I'm trying to retrieve the groups/users that have access to view a particular Sight (Dashboard) in Smartsheet. I'm using the Java API from Smartsheet but I also don't see any method that associates the groups to what they have access from either end (Sight or Group). Can anyone tell me if there is a way to get that information?
Thanks,
Eric

You can get that information by using the List Sight Shares operation.
As the documentation describes, the following code uses the Java SDK to retrieve sharing information for the specified Sight (without specifying pagination info):
smartsheet.sightResources().shareResources().listShares(
6327127650920324, // long sightId
null, // PaginationParameters
true // includeWorkspaceShares
);
This operation returns an IndexResult object that contains an array of Share objects -- one for each User or Group that has access to the specified Sight.

Related

uber cadence :: want to store an object inside a workflow

Want to store an object inside a workflow then want to receive it through cadence api.
ListOpenWorkflowExecutionsRequest listOpenWorkflowExecutionsRequest=new ListOpenWorkflowExecutionsRequest();
listOpenWorkflowExecutionsRequest.setDomain(DOMAIN);
listOpenWorkflowExecutionsRequest.setStartTimeFilter(startTimeFilter);
ListOpenWorkflowExecutionsResponse response=
cadenceService.ListOpenWorkflowExecutions(listOpenWorkflowExecutionsRequest);*
I am open to go with any solution.
Use the QueryWorkflowExecution API to retrieve information from a single workflow.
The list API is used to get lists of workflows without querying them directly. You can attach custom information (called memo) to a visibility record that is returned by a list API. Use WorkflowOptions.memo property to add it.
The memo is not indexable. If you want the ability to index on custom attributes use the Search Attributes feature. One other feature of search attributes is that they are updatable from the workflow code using upsertSearchAttributes API. So for example, if the workflow code updates the "state" attribute on each state transition then it would be possible to find all the workflows in a given state. Also, all the search attributes are returned by the list API so their value can be shown in the UI list view even if they are not part of the search predicate. Note that this requires Elastic Search cluster integration enabled.

Mailchimp API: How to get members in a list who have selected a particular interest

I am new to the Mailchimp API. I want to get a list of members from a list who have selected an interest (checkbox type) in an interest category. I don't know how to form the query statement for the members or search-members API method.
I did a web search for a Mailchimp API query example but couldn't find one pertaining to Groups.
I'm using Postman for now as part of my research. Here is an example of what I've tried (c133bd0ba3 is the ID of the Interest I want to check):
https://usX.api.mailchimp.com/3.0/search-members?query=c133bd0ba3=true,list_id=nnnxyz
I want the query to return a list of members who have selected the interest (value = true).
Any help is greatly appreciated.
Update: I found a way to get the information with the members API method call:
https://usX.api.mailchimp.com/3.0/lists/24b8bd6114/members?interest_category_id=2dd67a99be&interest_ids=8114c6945b&interest_match=all&fields=members.id,members.email_address
Curious if anyone knows how to create a query for the search-members API method to get this same result?
The search-members API endpoint only functions the way it does in app where you can only search specific strings like names, email addresses, but not ids as those aren't visible in app.
However using the query string ?interest_ids=X attached to the end of GET lists/list_id/members will pull up anyone with that specific Interest ID. But that is what you allready figured out!

How to properly access children by filtering parents in a single REST API call

I'm rewriting an API to be more RESTful, but I'm struggling with a design issue. I'll explain the situation first and then my question.
SITUATION:
I have two sets resources users and items. Each user has a list of item, so the resource path would like something like this:
api/v1/users/{userId}/items
Also each user has an isPrimary property, but only one user can be primary at a time. This means that if I want to get the primary user you'd do something like this:
api/v1/users?isPrimary=true
This should return a single "primary" user.
I have client of my API that wants to get the items of the primary user, but can't make two API calls (one to get the primary user and the second to get the items of the user, using the userId). Instead the client would like to make a single API call.
QUESTION:
How should I got about designing an API that fetches the items of a single user in only one API call when all the client has is the isPrimary query parameter for the user?
MY THOUGHTS:
I think I have a some options:
Option 1) api/v1/users?isPrimary=true will return the list of items along with the user data.
I don't like this one, because I have other API clients that call api/v1/users or api/v1/users?isPrimary=true to only get and parse through user data NOT item data. A user can have thousands of items, so returning those items every time would be taxing on both the client and the service.
Option 2) api/v1/users/items?isPrimary=true
I also don't like this because it's ugly and not really RESTful since there is not {userId} in the path and isPrimary isn't a property of items.
Option 3) api/v1/users?isPrimary=true&isShowingItems=true
This is like the first one, but I use another query parameter to flag whether or not to show the items belonging to the user in the response. The problem is that the query parameter is misleading because there is no isShowingItems property associated with a user.
Any help that you all could provide will be greatly appreciated. Thanks in advance.
There's no real standard solution for this, and all of your solutions are in my mind valid. So my answer will be a bit subjective.
Have you looked at HAL for your API format? HAL has a standard way to embed data from one resources into another (using _embedded) and it sounds like a pretty valid use-case for this.
The server can decide whether to embed the items based on a number of criteria, but one cheap solution might be to just add a query parameter like ?embed=items
Even if you don't use HAL, conceptually you could still copy this behavior similarly. Or maybe you only use _embedded. At least it's re-using an existing idea over building something new.
Aside from that practical solution, there is nothing in un-RESTful about exposing data at multiple endpoints. So if you created a resource like:
/v1/primary-user-with-items
Then this might be ugly and inconsistent with the rest of your API, but not inherently
'not RESTful' (sorry for the double negative).
You could include a List<User.Fieldset> parameter called fieldsets, and then include things if they are specified in fieldsets. This has the benefit that you can reuse the pattern by adding fieldsets onto any object in your API that has fields you might wish to include.
api/v1/users?isPrimary=true&fieldsets=items

How do i get all values from a global pick list in salesforce using REST Api?

I know i can get the values of the picklist via a call to describe an object.
Is it possible to get the values without adding the field to an object and to query the values regardless of the object it is used in?
Is it possible to do the same with GlobalValueSets? According to the documentation they are used since API 38.0 and later.
Since API 39.0 it is possible to access GlobalValueSets through the Tooling API. It is possible to access the GlobalValueSet without adding the field to an object.
The following REST call should be used:
GET /services/data/v39.0/tooling/sobjects/GlobalValueSet/{ID}
Where the ID can be found in SalesForce > Global Value Set > The Global Value Set you wish to access via the API > Grab the ID from the URL.

Rest API - Getting one-off information for an object

Here is my example. I have a basic rest api for a Member. Simple CRUD. Project manager says "we need an endpoint that will return the remaining pension amount for that member.
I get this stuff a lot where they want a very specific piece of information about an object.I don't want to include this in the Read request as the calculation can be time consuming. So, how do I do this in a RESTful way??
You could create a new endpoint called Pension, which could have a RemainingAmount property (and probably a RemainingCurrencyIso one, too), and expose that through a link from the Member resource like so:
GET /api/member/{id}/pension
If this is a field of the user object, you could have a separate url param
?fields=RemainingAmount
In the absence of the fields param, you just return the full object.