Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api route change #137

Merged
merged 17 commits into from
Mar 31, 2021
Merged

Api route change #137

merged 17 commits into from
Mar 31, 2021

Conversation

Synicix
Copy link
Contributor

@Synicix Synicix commented Mar 26, 2021

Depends on Pharus getting updated to the newest version. Please wait for the git submodule reference to be updated.

@Synicix Synicix marked this pull request as draft March 26, 2021 22:26
@guzman-raphael
Copy link
Collaborator

guzman-raphael commented Mar 29, 2021

@Synicix Pushed the last commit that will complete the resource naming changes on the pharus side in datajoint/pharus#99. Still need to clean up things, update tests, and update docs but the interface should be locked in. Would you review each endpoint and update things here to match? Notable changes since we met are:

  • Consolidated /get_table_attributes and /get_table_definition -> GET /attribute
  • Update the naming of the keys in returned objects to follow typical naming convention e.g. lowerUpperUpper

@Synicix
Copy link
Contributor Author

Synicix commented Mar 29, 2021

@Synicix Pushed the last commit that will complete the resource naming changes on the pharus side in datajoint/pharus#99. Still need to clean up things, update tests, and update docs but the interface should be locked in. Would you review each endpoint and update things here to match? Notable changes since we met are:

  • Consolidated /get_table_attributes and /get_table_definition -> GET /attribute
  • Update the naming of the keys in returned objects to follow typical naming convention e.g. lowerUpperUpper

cool

@guzman-raphael
Copy link
Collaborator

@Synicix I have just pushed an update that addresses the new API design we discussed. The discussed design was:

- /version: GET=API version
- /login: POST=generate access token
- /schema: GET=list scheams, POST=create schema
  - {schemaName}: GET=verify exists and available methods, PATCH=rename schema, DELETE=drop schema
    - /table: GET=list tables, POST=create table
      - {tableName}: GET=verify exists and available methods, PATCH=rename table, DELETE=drop table
        - /attribute: GET=list parsed attributes, PATCH=alter table attributes
        - /definition: GET=get table definition
        - /record: GET=list records (paging, restriction), POST=insert many records, PATCH=update many records, DELETE=delete many records (restriction)
        - /dependency: GET=list child records (restriction)

Aside from the above, also note:

  • insert and update now handle multiple values so it expects an array. Example payload:
    {
    	"records": [
    		{
    			"computer_id": "ffffffff-86d5-4af7-a013-89bde75528bd",
    			"computer_serial": "ZYXWVEISJ",
    			"computer_brand": "HP",
    			"computer_built": "2021-01-01",
    			"computer_processor": 2.7,
    			"computer_memory": 32,
    			"computer_weight": 3.7,
    			"computer_cost": 599.99,
    			"computer_preowned": 0,
    			"computer_purchased": "2021-02-01 13:00:00",
    			"computer_updates": 0
    		}
    	]
    }
  • delete now accepts a restriction exactly the same as fetch i.e. using filters. This now allows it to delete multiple records if required but we'll just need to be extra careful on the frontend side to send only the primary key values for the specific single record selection to delete.

@Synicix Synicix linked an issue Mar 29, 2021 that may be closed by this pull request
@Synicix Synicix marked this pull request as ready for review March 30, 2021 19:31
@guzman-raphael guzman-raphael added this to the Official Release milestone Mar 31, 2021
@Synicix
Copy link
Contributor Author

Synicix commented Mar 31, 2021

Depends on datajoint/pharus#100 now

value: String(value)
})
}
console.log(restrictionsInAPIFormat)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a debug print that should likely be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Collaborator

@guzman-raphael guzman-raphael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Synicix Now merging datajoint/pharus#100, we should update the submodule ref to match.

@Synicix
Copy link
Contributor Author

Synicix commented Mar 31, 2021

@Synicix Now merging datajoint/pharus#100, we should update the submodule ref to match.

Submodule should be updated now

guzman-raphael
guzman-raphael previously approved these changes Mar 31, 2021
@guzman-raphael guzman-raphael merged commit 2fb80e6 into datajoint:dev Mar 31, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update backend calls per REST naming resource convention
2 participants