Hi I'am trying to query most liked and commented news in SharePoint SitePages however when trying to order descending using _LikeCount and _CommentCount i received this error:
A provided field name is not recognized
. I dont have any issue with other fields except these two.
https://graph.microsoft.com/v1.0/sites/{ID}/lists/Site Pages/items?$filter=fields/PromotedState eq 2&expand=fields($select=createdDateTime,BannerImageUrl,PromotedState,FileLeafRef,AuthorLookupId,Modified,_CommentCount,_LikeCount,Title,Description,LinkTitle)&$top=5&$orderby=fields/_LikeCount desc
Any help is appreciated. Thanks!
It seems to me that PromotedState field name is not recognized as a valid field name and also $orderby clause does not support ordering by field _LikeCount.
Try run the query without $filter and $orderby to check what fields are returned
https://graph.microsoft.com/v1.0/sites/{ID}/lists/Site Pages/items?$expand=fields($select=createdDateTime,BannerImageUrl,PromotedState,FileLeafRef,AuthorLookupId,Modified,_CommentCount,_LikeCount,Title,Description,LinkTitle)&$top=5
Run the query with the $orderby
https://graph.microsoft.com/v1.0/sites/{ID}/lists/Site Pages/items?$expand=fields($select=createdDateTime,BannerImageUrl,PromotedState,FileLeafRef,AuthorLookupId,Modified,_CommentCount,_LikeCount,Title,Description,LinkTitle)&$top=5&$orderby=fields/_LikeCount desc
It will return invalidRequest error.
Run the query with the $filter
https://graph.microsoft.com/v1.0/sites/{ID}/lists/Site Pages/items?$expand=fields($select=createdDateTime,BannerImageUrl,PromotedState,FileLeafRef,AuthorLookupId,Modified,_CommentCount,_LikeCount,Title,Description,LinkTitle)&$filter=fields/PromotedState eq 2&$top=5
It will return invalidRequest error.
Related
Sorry if this is a bit vague or rambly, I'm still getting to grips with Data Factory and a lot of it seems a bit obtuse...
What I want to do is query my Cosmos Database for a list of Ids of records that need to be updated. For each of these records, I want to call a REST API using the Id (i.e. /Record/{Id}/Details)
I've created a Data Flow that took a string as a parameter and then called the REST API fine.
I then made a pipeline using a Lookup with a query (select c.RecordId from c where...) and pass that into a ForEach with items set to #activity('Lookup1').output.value
I then setup the Activity of the ForEach to my Data flow. From research, I think I'm supposed to set the Parameter value to "#item().RecordId", but that gives an error "parameter [name] does not match parameter type 'string'".
I can change the type of the parameter to any (and use toString([parameter]) to cast it ) and then when I try and debug it passes the parameter in, but it gives an error of "Job failed due to reason: at (Line 2/Col 14): Datatype any not found".
I'm not sure what the solution is. Is there a way to cast the result of the lookup to an integer or string? Is there a way to narrow an any down? Is there a better way than toString() that would work? Is there a better way than ForEach?
I tried to reproduce similar scenario what you are trying.
My sample data in cosmos
To query Cosmos Database for a list of Ids and call a REST API using the Id For each of these records.
First, I took Lookup activity in data factory and selected the id's where the last_name is Bluth
Its output and settings are as below:
Then I passed the output of lookup activity to For-each activity.
Then inside for each activity I created Dataflow activity and for that DataSource I gave the source as Rest API. My Rest API to call specific user is https://reqres.in/api/users/2 I gave base URL as https://reqres.in/api/users.
Then I created parameter called demoId as datatype string and in relative URL I gave that dynamic value as #dataset().demoId
After this I gave value source parameter as #item().id as after https://reqres.in/api/users there is only id should be provided to get data in you case you can try Record/#{item().id}/Details.
For each id it is successfully passing id to rest API and fetching data:
I'm new to the dynamodb. I'm encountering an irritating problem
I have a record stored in the dynamodb like this:
{
bmgIds: ["d5a03ea2-e06e-5d01-84b7-94530b1059f7"],
id: "d5a03ea2-e06e-5d01-84b7-94530b1059f7",
.....
}
as you see, bmgIds array contains id value, when i used scan operation to get records has bmgIds match my condition but cannot get that record with my code
Model.scan('bmgIds').contains("d5a03ea2-e06e-5d01-84b7-94530b1059f7").exec()
I noticed that I can get records has bmgIds field not contains id value with code above
please help to explain where I'm wrong!
sorry I'm bad in English, I wish to receive help from you, thanks
Due to AWS scan response limit
I am trying to put together a compound json query string using the where filter to access my loopback API. Simple or statements work when they are the only items in the query string.
https://loopback.io/doc/en/lb4/Parsing-requests.html
As an example the following query string will return the two correct ids:
http://xxx.xxx.xxx/api/products?filter={"where":{"or":[{"ProductId": "AOC"},{"ProductId": "BCK"}]}}
But when I try to make it more complex such as trying to filter for all "flower" products that have a strain type of "I" or "H", I get a 400 error:
http://xxx.xxx.xxx/api/products?filter=filter={"where":{"and":[{"ProductType": "flower"},{"or":[{"ProductStrain": "H"},{"ProductStrain": "I"}]}]}}
Same with:
http://xxx.xxx.xxx/api/products?filter=filter={"where": {"ProductType": "flower"},{"or":[{"ProductStrain": "I"},{"ProductStrain": "H"}]}}
I am guessing that I have a syntax issue, but I have tried a dozen different ways and still haven't got what I want. Can someone point me in the right direction?
I am getting error.internalServerError when sorting generated entity in generated table view. It leads to error only in case of fields with database names with underscore. For example project_owner.
In my console I am getting this:
GET http://localhost:9000/api/projects?cacheBuster=1489187431846&page=0&size=20&sort=image_logo_url,asc&sort=id 500 (Internal Server Error)
Is it a bug, or only my local problem?! Thanks.
The problem is in wrong parsing. See this URL for more information:
https://jira.spring.io/browse/DATACMNS-816
I thought, that when I generate field with name project_owner, it will be stored as project_owner, but entity name will be camelCase -> projectOwner.
So If you have the same issue, check your entity names and refactor them to camelCase syntax.
i am trying to filter records using key.For example
localhost:5984/school/_design/school/_view/schoolstats?startkey=[Name,DOB,AGE]&endkey=[Name,DOB,AGE]
1)filter using Name only
2)filter using Name and Age only
3)filter using Name and DOB only
4)filter using Age only
I have tried a lot using wildcard in couchdb but cant able to fetch the exact result.
If you use a ranged query with startkey and endkey, the order of keys is not changeable.
These combination should be working. If you need other combination you have to emit your multikey in the desired form.
startkey=[Name]&endkey=[Name,{}]
startkey=[Name,DOB]&endkey=[Name,{}]
startkey=[Name,DOB,AGE]&endkey=[Name,{}]
startkey=[Name,DOB]&endkey=[Name,DOB,{}]
For your asked filters, you have to emit two more keys/multikeys in your map function.
I think, if you do not change your emitting keys, aka, you have a emitting statement like: emit [Name,DOB,AGE], null
1)Filter using Name only
startkey=[Name]&endkey=[Name,{}]
2)Filter using Name and Age only
Can not
3)Filter using Name and DOB only
startkey=[Name,DOB]&endkey=[Name,DOB,{}]
4)Filter using Age only
Can not