Clio API v4; Endpoint for getting list of documents within one folder - clio-api

Problem: Getting a list of documents that exist in a specific folder
Tried solution:
endpoint /api/v4/folders/list.json seems to be working exactly the same as /api/v4/folders.json
Something similar to this - similar endpoint doesn't seem to exist
Filtering documents by parent_id, however this functionality doesn't exist
Is there some kind of example of the endpoint to perform such operation?

Reading the documentation, it appears as though /api/v4/folders/list.json returns the contents of a folder. If you are trying to get a list of all the documents within the folder 1425540709 (using your example above) then your GET would add a parameter "parent_id = 1425540709". According to the documentation, if you don't send a "parent_id" it defaults to the root folder for the account.
Your request url should look like this I believe:
https://app.goclio.com/api/v4/folders/list.json?parent_id=1425540709&limit=25
The response will be a json array of the items within that folder.
Make sure you send it a parameter for what fields you want back too because otherwise the api defaults to just id and etag.

Related

How to get a list of all documents in a Firebase Cloud Firestore database using the API?

I need to query my Cloud Firestore database periodically for maintenance. I'm new to REST and I've spent way too long trying to solve this myself, so I figured I could use some advice.
My Firestore is set up like so:
users > {uid} > uploaded-files > {file-hash}
{file-hash} is a document that contains several fields such as filename, source, and size
All I'm trying to do is get a list of every single filename from every single uploaded-file, including from multiple {uid}'s.
I've managed to send a successful request and get a single filename using the firestore.projects.databases.documents.get method using the API explorer, but I can't seem to get any other methods to work, namely firestore.projects.databases.documents.list
This is the successful request using firestore.projects.databases.documents.get:
GET https://firestore.googleapis.com/v1beta1/projects/{project-id}/databases/(default)/documents/users/7eGfdgGfaG0HSXdfmxMN2/uploaded-files/WGtcJBX9fdGdhdtjB?mask.fieldPaths=filename&key={YOUR_API_KEY}
Part of my issue is that I can't figure out how to get requests to work without hard-linking document names - in other words, I don't know how to to replace {uid}, or any other collection, with a wild-card so that the request returns documents from all uid's.
Really any help is greatly appreciated.
The Use the Cloud Firestore REST API documentation has instructions on getting started. The Firestore REST API documentation shows how to fetch documents.
In your case you would need to list the user-uid documents then go after the uploaded-files for each one, or iterate over the results of the list.

Add subcategories in a filtered API Restful resource

I'll give an example as the title might sound a bit confusing.
How to build a resource path for something like that:
GET /courses/?language=english&active=true/units
I want to filter the courses (not using an id as usually) and then get the units of this result. How would you do that? I guess using question marks between the path is not allowed.
That would depend a little on your DB schema of what is a "course" and a "unit". The whole point on using the RESTful way is to always build requests and urls resource-specific.
But let's say that one course has X units on it. Here's what i would do to make a RESTful path to that request:
Due to the path problem of filtering courses AND using the /unit suffix, it can be done by adding another query parameter that specifies what fields the request is supposed to return. Something like this:
GET /courses?language=english&active=true&fields=units
That would filter the courses, and then return only the 'units' field on the response. As i said, depending on your DB and models, if the units are not stored inside the courses, it would be a bad practice to get them by requesting a /courses path. In that case, first request the courses that match the desired filter, and then make another request to the /units context sending i.e the courses ID's as query parameters.

Sharepoint REST api GetFolderByServerRelativeUrl returning syetem folder

I am using GetFolderByServerRelativeUrl REST api to get Folders and Files from Office365 document library. I am usng below query
https://mysite.sharepoint.com/_api/web/GetFolderByServerRelativeUrl('Documents')?$expand=Folders,Files
It is returning Folders and Files as expected, but also giving one folder named 'Forms' how can i exclude that?
Also using the same call how can i get author name(modified by).

How to organise REST endpoints for a drop-wizard application?

I am new to dropwizard and REST.
My sample application is a order viewing system. Currently, I am working on a functionality where the UI page consists of set of order search criteria, search button, and link to download the search result as CSV. Download link is displayed only after the successful search. The application has to write the search result to a CSV file and the file location returned will be used to download the file.
I need help in organising the endpoints for this.
Initially, I thought of an end point GET - /orders - text/JSON with search criteria passed in as query params. But, since I will be actually creating the CSV for every GET request, I am wondering if I am violating the HATEOAS rest constraint for the GET (resource should not be created). Or, since the actual resource is Order and not the CSV, is it ok to have the endpoint as GET?
Or, do I need multiple endpoints adhering to the REST constraints and conventions interacting with each other to produce the required result?
Like:
1.POST - /orders/csv - text/json (file name) : creates the CSV file of orders and returns the JSON of file name.
2.GET /orders/csv/<file_name>: gets the file to download.
Many thanks for your help.

Querying Raven Db

I have an instance of Raven Db at localhost:8081. I made sure to change raven's config file to allow anonymous access. I created a database named AT. Inside AT I have a collection named Admins. Inside of Admins I have two documents. I'm trying to retrieve some data via Rest using RestClient. I try to hit the db using:
http://localhost:8081/docs/admins/7cb95e9a (last bit is the id of the document I want).
and
http://localhost:8081/docs/at/admins/7cb95e9a.
With both I receive a 404. I'm not sure what I'm missing here. Can someone point me in the right direction?
The URL has the following format:
http://localhost:8081/databases/{{database-name}}/docs/{{document-id}}.
Collection is a virtual thing. get a document only by its ID, there no nothing on collection here. The document ID can be anything you set, but if you let RavenDB to generate it, it will probably be admins/1.