I'm looking for some advice on how to approach retrieving the users from a given group of the activti-app. Having read the documentation I've attempted to hit the endpoint associated with users and their groups by a posting a JSON body containing an array of user task filter ids.
Testing this in Postman returns a 500 internal server error "exception": "Request method 'POST' not supported". Obviously this is because I should be making a GET request however I cannot attach a JSON body in that case.
Aforementioned example endpoint: localhost:8080/activiti-app/api/enterprise/groups/{group_id}/users
Aforementioned docs:
https://docs.alfresco.com/activiti/docs/dev-guide/1.5.0/#_user_and_group_lists
Specifically this section Screencap of activti docs
Any suggestions would be greatly appreciated!
Thanks!
First, we have to make sure we are talking about "organization groups" not "capabilities groups". That was my original confusion. Once I create the right kind of group I could successfully use the REST API to fetch both a list of groups and a list of group members.
As the docs point out, to get a list of groups, do this:
curl -uadmin#app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups
Which returns:
{
"size":2,
"total":2,
"start":0,
"data":[
{"id":5,"name":"test-org-group-1","externalId":null,"status":"active","groups":null},
{"id":6,"name":"test-org-group-2","externalId":null,"status":"active","groups":null}
]
}
If you want to pass a filter, do it with "?filter=some-group-name".
Now, to see the members of a specific group, pass in the group ID, which is a numeric. So to see the members of test-org-group-1 I would use:
curl -uadmin#app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups/5/users
Which returns:
{
"size":2,
"total":2,
"start":0,
"data": [
{"id":2,"firstName":"Test","lastName":"User1","email":"tuser1#metaversant.com"},
{"id":3,"firstName":"Test","lastName":"User2","email":"tuser2#metaversant.com"}
]
}
Related
I'm trying to get my head around Vimeo API with Python. I'm successful in the sense that I can use basic API requests e.g. to list all my videos or similar.
Mostly, I use the /me/videos/ API endpoint. The API reference states, that there can be two options 'query_fields' and 'query'. If I just use 'query', I can filter the results e.g. by a string in the title. I'm assuming this works, because the default value for 'query_fields' is title,description,chapters,tags' according to the API reference.
But what i'd like to do is to use the 'query_fields' for something like:
'query_fields': 'privacy.view'
'query': 'unlisted'
But if I try that, a generic error message is returned
{
"error": "Searching for a page that does not exist or is too far back in our catalog to present.",
"link": null,
"developer_message": "The user's from + size exceeded 10,000, they requested a page of results that does not exist, or they issued an invalid query as defined in the QueryPreprocessorPlugin.",
"error_code": 2969
}
Has anyone been able to use the 'query_fields' option on any way other than the defautl fields?
You can't query any fields with query_fields, the only valid fields are the ones listed in the docs ('title', 'description', 'chapters', 'tags').
You'd need to manually filter on privacy.view, so i.e.
GET /me/videos?fields=uri,privacy.view
And loop through this filtering for the values you want.
I am trying to get a list of GitHub Repo names for my organisation.
Using Postman I have used:
GET https://api.github.com/orgs/ORGNAME/repos
This responds with all of the data for each repo. Is there a way to just return the repo names?
Thanks!
It's not possible with the REST API. You need to use their GraphQL API to fetch specific fields.
With the REST Api you will always get the full dataset, but with Graphql you can query your way around to fetch only what you need. here is a sample :
To fetch the data in graphql the method must be POST, put the base url https://api.github.com/graphql
in the body of the request select GraphQL. and add the following query in QUERY:
query MyQuery {
nodes(ids: ["#node_id"]) {
... on Organization {
repositories(first: 10) {
nodes {
name
}
}
}
}
}
PS: replace node_id with your org node_id
in Authorization tab select TYPE Bearer Token and add your Github access token(https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
I am new to spring boot and rest and hence pardon me if this question is very trivial.
I have a situation where the application allows users to register and place order.
On registration of user, the service should be able to send a response with the user information including - User Name, email, contact Number, address etc.
However, while placing orders, I would like the order response object to include within the order details, only the customer (username, email). I do not want to include the address and other information part of the User object.
Currently, what is happening is whenever, I refer to an existing user instance within the Order instance, the Order response has the complete tuple information of the registered user.
In the Order confirmation response, I really do not want the entire User information.
However, if the same Order entity is being referenced for user register, I want the service to include all fields from the Order entity.
I have tried referring to the following links -
Jackson Change JsonIgnore Dynamically
How do I exclude fields with Jackson not using annotations?
However, the solutions mentioned here will always ignore the attribute in response irrespective of the scenario in which the entity is being referenced.
For example - Response from Order service is as below.
{
"id": "ORD-1000",
"priority": null,
"status": "Open",
"customer": {
"id": "1000",
"name": "Avion Solutions",
"email": "support-na#avionsolutions.com",
"contact": null,
"customerType": "gold-sx",
"shipToContactId": null,
"billToContactId": null
},
"urgency": null
}
In the above response tuple, lets say, I just want the order information with basic customer information such as name & email.
And if the customer is registering, then the response should contain all the information as mentioned in the above tuple.
How can i dynamically ignore the attributes in response of the REST service based on the context in which the entity object is being used?
Thanks in advance.
Try to use #JsonView annotation. You can define visibility for given property and on REST Controller you can define level you want to show. For more information and examples, please, read below:
Jackson JSON Views
Jackson – Bidirectional Relationships
Using #JsonView with Spring MVC
I'm trying to query Wikipedia API and retrieve the subcategories for a list of multiple categories, but it returns a 'bad title' error. I can't seem to find a solution in the documentation, anyone know if this is possible? Or do I need to run queries for one category at a time? Thanks!
Query:
https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Ice_hockey_by_country|Category:Ice_hockey_by_city&cmprop=title&cmtype=subcat&cmlimit=50
"error": {
"code": "invalidtitle",
"info": "Bad title \"Category:Ice_hockey_by_country|Category:Ice_hockey_by_city\".",
"*": "See https://en.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
Note that this query for a single category seems to work:
https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Ice_hockey_by_country&cmprop=title&cmtype=subcat&cmlimit=50
From what I read in the categorymembers documentation, the cmtitle parameter does not accept more than one category. It likely interpreted it as one category named Category:Ice_hockey_by_country|Category:Ice_hockey_by_city instead of the two separate categories that you intended.
I guess you'll need to query the categories separately.
i am working with dynamodb to insert and retrieve records from dynamo. please note that when i insert the record to dynamo db it is working fine but when i try to list any item or retrieve any item from dynamodb it return no result found
for retrieving of record
created a iam role which has trust relationship with api gateway. and has managed policies : AmazonAPIGatewayInvokeFullAccess , AmazonDynamoDBFullAccess , APIGatewayAWSProxyExecPolicy , AmazonAPIGatewayAdministrator.
created a table named, emp which has the field ID and name.
created an api gateway named emp, which has resource /employee. and has method post and get. post for insert and get for display record.
for get method selected aws service proxy
then in URL Query String Parameters added id in method request.
then also in integration request > URL Query String Parameters added > ID and method.request.querystring.id.
in integration request > body mapping template added application/json and then the json code
{
"TableName": "emp",
"KeyConditionExpression": "ID = :v1",
"ExpressionAttributeValues": {
":v1": {
"S": "$input.params('ID')"
}
}
}
then when i tested it it returns no result I cannot figure out why please help.
I'm not an expert on this, but I can see two issues.
First in the DynamoDB service proxy settings the HTTP method needs to be POST, as you are POSTing a request to DynamoDB API, and it has nothing to do with the the fact the you use the GetItem method.
Second, your body mapping template uses KeyconditionExpression that is used in DynamoDB Query API, but not in the GetItem. GetItem needs a Key specified, like here: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html#API_GetItem_Examples
Hope this helps.