API endpoints #11
Comments
In addition to this issue: Keep two separate query calls is ok, though the "preview" call should have the column name in the data object. Current situation when querying the preview data: {
0: 'some value',
1: 'other value'
} Preferred situation when querying the preview data: {
name: 'some value',
someKey: 'other value'
} On this way we can stop doing big data manipulations in the frontend. |
Hi @andykram As we discussed I would come up with some ideas about a more consistent API for AirPal, so here are some ideas. Table endpoints:
Table information endpoints
Query endpoints:
Currently this is done by a PUT request, which doesn't make any sense (in my eyes), because a PUT (or PATCH) request should only be fired to the API on an existing resource. Though this resource doesn't exists yet, and should be created.
This should not be used to kill/cancel a query, I would say we should use the PATCH request for this use-case. If we make the API endpoints like the proposed endpoints, we've got a more consistent and RESTful API for the AirPal project. I'm not sure about the last two endpoints for the Table yet. This is because I'm not sure how we currently use the schema and table. Can you explain some more about what the difference between a table and the schema is? And is it really needed to keep the schema and table name in an url? Or would only the table ID (or name?) be enough to get the right data? @jamesmay: As I understood from the user interviews, most of the users don't need to see the other queries, right?! Is this something we want to keep or do you think it's more reasonable to only show your own queries? What do you guys think? |
I proposed that the For the personal results I would like to propose a new API endpoint. Query Endpoints
User Endpoints
|
Also would like to propose a new endpoint for the permissions API. This should be part of the user endpoints.
And maybe also an endpoint for the logged in user.
|
I think the recent suggestions make sense and I'll start on implementing them. |
@stefanvermaas: In the proposal for the |
I'm open for suggestions, because I haven't figured this out yet.. We could set the user id in the sessionsStorage when the user logs in? But I doubt how safe this is.. @jamesmay could you provide some feedback on the earlier questions? |
@stefanvermaas: I propose an
|
Sounds fine to me :)! 👍 — On Thu, Nov 6, 2014 at 9:51 PM, Andy Kramolisch notifications@github.com
|
Hey Stefan, sorry for the delay. Here is my feedback after reading the thread: "[PATCH] api/queries/:id (update a query) [James Mayfield] Love this! We should also allow users to delete queries from the interface. There are times when I am running a series of analysis, and mess up a query, and don't want to see it in my history while I'm building new queries that rely on previous work. It was very common for people to delete these things from their history. "As I understood from the user interviews, most of the users don't need to see the other queries, right?! Is this something we want to keep or do you think it's more reasonable to only show your own queries?" [James Mayfield] Users definitely want to see their own queries in Airpal by default. But, there are times when it is super useful to see how other people are querying a table, what they are joining it to, and if they are filtering out certain values. Additionally, it’s great to be able to look up specific functions and regex that co-workers are authoring. We should include this. |
Awesome! Thanks for the feedback @jamesmay |
Hi @andykram Could you look into this: When a query is not found (GET api/queries/:id) it would be better to return a 404 status code, instead of an empty body. This way I can catch the error :) Also: do you've got a example of the JSON data that will be returned for every resource? Cheers! |
JSON data examples:
|
Some thoughts on the |
Sorry for the delayed answer :(.. I guess a PATCH request would be more appropriate, because you're actually not deleting the query, but just canceling it. The query must stay in the personal history of a person, until the user removes the query. As @jamesmay said, it might be handy to delete queries, so if we want to implement that feature, we should use the DELETE request for this and the PATCH request for updating/canceling the query. Thanks BTW for the JSON data :)! Looks awesome! Just some thoughts on the And I have to say: Fantastic work ^^! It's looking great. I've reserved this week a couple of days to work on the final version for the new front-end application. |
I think the issue here is that there are two different entities, a Query History Item and a Query Execution Item, and the API doesn't entirely distinguish between them. I think |
Yeah indeed I noticed when I was implementing the new API tonight.. Indeed we need different endpoints for executing and for saving. I forgot about this difference while working out the API endpoints. What do you think? Should we keep /queries/execute for running the query just once, without saving? On the other hand; is executing really different to saving a query? What makes it different, because when we execute a query, we're saving it, but without name and description right? Or am I missing something? Would it make a difference to use PUT instead of PATCH? Otherwise we definitely stick with DELETE. |
When you "create a query" I view it as issuing a query that will start running. When it is completed, regardless of success or failure, a record of it being ran is created. When you "save a query" you create a separate entity that remembers the query for you and will display it on subsequent page loads. For these reasons I view the Currently you "create a query" via |
Ah this totally makes sense! Shouldn't we separate these API calls then? Maybe one for |
Sorry for the delayed response. I think we keep it as it is for now unless it's blocking you. We can always do something more traditionally RESTful once the project is out. |
Hi @andykram,
Currently we need to call the API twice if we want both the column names and the column data. What's the reason behind this? Speed?
Cheers
The text was updated successfully, but these errors were encountered: