Strongloop API response limit over Oracle Database - rest

I've just started using Strongloop to define a REST api over my oracle database.
Everything works fine when I check my API using "localhost:3000/explorer".
For instance, when I send a "get" to list all persons, the server answers with the list of people in the PERSONS table.
The issue is that the server does not return all the records in the table.
It returns a 100 records only, knowing that the table contains more than a 100 records.
Am I missing something?

I found the solution, in case someone faces the same issue.
The problem is that in loopback-connector-oracle, the maximum number of rows is set to 100.
To change the maximum rows you should :
1- In "datasources.json" file, set the property "maxRows" to the number you want, for instance "maxRows":1000
2- Replace the file \node_modules\loopback-connector-oracle\lib\oracle.js with the file oracle.js
3- Restart your API, now it will return more than 100 records
See this link for more details about the issue

I don't think there is any such thing, by default it will fetch all the records.
Please check your table/database settings.

Related

Azure DevOps REST API call retrieving only 100 records

I am using the below url for retrieving all the CouldTests, but it is returning only top 100 records. Is it possible to retrieve all the records?.
http://{instance}/{collection}/{project}/_apis/test/runs?api-version=5.0
Any help is appreciated. Thanks in advance
For more about the above Link please refer.:https://learn.microsoft.com/en-us/rest/api/azure/devops/test/runs/list?view=azure-devops-server-rest-5.0
it is returning only top 100 records.
This is because
On large collections, performance degrades when retrieving the later pages.
To avoid stress on the server, 100 is the default page size of REST api response which you can refer to REST API Result limit.
Is it possible to retrieve all the records?
Yes, as #Shayki Abramczyk said, the solution is to add a top parameter to select the top n records, make sure the n is bigger than the total amount of your all records.
For this solution, you can also check Limited to 100 result TFS api and Azure DevOps REST API: project count returned limited to 100.
You can use the $top parameter in the URL:
http://{instance:/{collection}/{projects}/_apis/test/runs?api-versopn=5.0&$top=500
Accepted answer was not working for me. Probably they have changed the parameter name from $top, to searchCriteria.$top.
If that is not working, try this instead:
https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits?searchCriteria.$top=1000&api-version=6.0
Documentation:
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits?view=azure-devops-rest-6.0

explanation on HTTPS Records Query

Can anyone please explain how first set, previous set, next set, and the last set of records can be used to query HTTP rest message data. what exactly does this do?
I got some information in ServiceNow website, where i am not able to understand.
Can we use this instead of sysparm_limit/sysparm_offset technique to fetch the records?
Yes, it's there for pagination on your side.
To get the first 10 records you can set sysparm_limit=10 and sysparm_offset=0. To get the next 10 records you should set sysparm_limit=10 and sysparm_offset=10.

IBM Cloudant DB - get historical data - best way?

I'm pretty confused concerning this hip thing called NoSQL, especially CloudantDB by Bluemix. As you know, this DB doesn't store the values chronologically. It's the programmer's task to sort the entries in case he wants the data to.. well.. be sorted.
What I try to achive is to simply get the last let's say 100 values a sensor has sent to Watson IoT (which saves everything in the connected CloudantDB) in an ORDERED way. In the end it would be nice to show them in a D3.css style kind of graph but that's another task. I first need the values in an ordered array.
What I tried so far: I used curl to get the data via PHP from https://averylongID-bluemix.cloudant.com/iotp_orgID_iotdb_2018-01-25/_all_docs?limit=20&include_docs=true';
What I get is an unsorted array of 20 row entries with random timestamps. The last 20 entries in the DB. But not in terms of timestamps.
My question is now: Do you know of a way to get the "last" 20 entries? Sorted by timestamp? I did a POST request with a JSON string where I wanted the data to be sorted by the timestamp, but that doesn't work, maybe because of the ISO timestamp string.
Do I really have to write a javascript or PHP script to get ALL the database entries and then look for the 20 or 100 last entries by parsing the timestamp, sorting the array again and then get the (now really) last entries? I can't believe that.
Many thanks in advance!
I finally found out how to get the data in a nice ordered way. The key is to use the _design api together with the _view api.
So a curl request with the following URL / attributes and a query string did the job:
https://alphanumerical_something-bluemix.cloudant.com/iotp_orgID_iotdb_2018-01-25/_design/iotp/_view/by-date?limit=120&q=name:%27timestamp%27
The curl result gets me the first (in terms of time) 120 entries. I just have to find out how to get the last entries, but that's already a pretty good result. I can now pass the data on to a nice JS chart and display it.
One option may be to include the timestamp as part of the ID. The _all_docs query returns documents in order by id.
If that approach does not work for you, you could look at creating a secondary index based on the timestamp field. One type of index is Cloudant Query:
https://console.bluemix.net/docs/services/Cloudant/api/cloudant_query.html#query
Cloudant query allows you to specify a sort argument:
https://console.bluemix.net/docs/services/Cloudant/api/cloudant_query.html#sort-syntax
Another approach that may be useful for you is the _changes api:
https://console.bluemix.net/docs/services/Cloudant/api/database.html#get-changes
The changes API allows you to receive a continuous feed of changes in your database. You could feed these changes into a D3 chart for example.

Caching Issue with Teiid Virtual DB with ODATA Query

I have a business scenario where, whenever a new record is loaded into a DB table,
a) A notification will be sent to the client. Notification message is to convey data is loaded and ready for querying.
b) Upon receiving the notification, the Client will make an OData query to the JBOSS vitrual DB. Odata is supported by Teiid VDB
Problem is that: The new records (inserted via manual/automated SL script) that are not returned in the ODATA query response. It is always returning the cached result for first 5 minutes. Because the Odata has a default cache time setting to 5 minutes.
We want TEIID to always return all the records including the newly inserted one.
I tried the following option but it is not working as expected (https://developer.jboss.org/wiki/AHowToGuideForMaterializationcachingViewsInTeiid)
1) Cache hints
/*+ cache(ttl:300000) */ select * from Source.UpdateProduct
2) OPTION NOCACH
**** This works when I make a JDBC query to the DB.
Please suggest, how to turn off this caching in case of ODATA REST query ?
I think Teiid documentation https://docs.jboss.org/author/display/TEIID/OData+Support could help.
You don't specify version of Teiid you use, so I enclose the most current version's documentation.
Now when you go through the docs page, at the bottom there is section Configuration, where there are several configurable options.
Doesn't the skiptoken-cache-time option serve your need? Try setting it to lower value/zero and see if this helps. Just locate the odata war, open it, and change the WEB-INF/web.xml file.
Jan

What is the cs_PostViews Table used for in Community Server

I'm running Community Server 2.1 at the moment. My cs_PostViews table is at 200MB. What is the exact use of this table. Is it safe to truncate?
Found out myself.
This table holds a list of every single unique URL that was requested and served. I.e. no 404 type URLs and the number of times it has been requested.
I ended up truncating this table with no ill effects so far.