API Works - uclibs/ucrate GitHub Wiki
Calls
| Method | URL (https://scholar.uc.edu) | Description | 
|---|---|---|
| GET | /api/concern/work_type/id(.json) | 
Return a work. | 
| PATCH | /api/concern/work_type/id(.json) | 
Update a work. | 
| POST | /api/concern/work_type | 
Create a work. | 
The current valid work_types are: etds, articles, documents, datasets, images, media, student_works, generic_works.
The id field is only if you have an existing id, you can't make your own.
Fields
| Field | Required | Work Type(s) | Multi-Valued | Notes | 
|---|---|---|---|---|
| For creating | All works | no | Needed in case the uploader doesn't have an account | |
| first_name | For creating | All works | no | Needed in case the uploader doesn't have an account | 
| last_name | For creating | All works | no | Needed in case the uploader doesn't have an account | 
| access | no | All works | no | Must be either open, authenticated, or "restricted" for private (defaults to private) | 
| title | For creating | All works | no | |
| creator | For creating | All works | yes | |
| college | no | All works | no | Must be a college in config/college_and_department.yml. This field when not set will use the users current college | 
| department | no | All works | yes | This field when not set will use the users current department | 
| description | For creating | All works | no | |
| license | For creating | All works | no | Must be a license in config/authorities/licenses.yml | 
| publisher | no | All works except Etds | yes | |
| date_created | no | All works | no | |
| alternate_title | no | All works | yes | |
| subject | no | All works | yes | |
| geo_subject | no | All works | yes | |
| time_period | no | All works | yes | |
| language | no | All works | yes | |
| required_software | no | All works | no | |
| note | no | All works | no | |
| related_url | no | All works | yes | |
| genre | no | Document, Image, Student Works | no | Must be a genre in config/authorities/genre_types_student_work.yml, config/authorities/genre_types_document.yml or config/authorities/genre_types_image.yml | 
| advisor | no | Etds, Student Works | yes | |
| degree | no | Etds, Student Works | no | |
| committee_member | no | Etds, Student Works | yes | |
| etd_publisher | no | Etds, Student Works | no | |
| journal_title | no | Articles | yes | |
| issn | no | Articles | yes | |
| attachments[][file] | no | All works | no | This a unique field. Since this allows files to be uploaded, it uses a special format to allow for it to be uploaded. In curl it looks like -F 'attachments[][file]=@new_image.jpg', and you can submit this field multiple times. It currently only works when creating works. | 
| create_user | no | All works | no | This field allows you to create a user if the supplied user is not given. This is only allowed when creating works. | 
Multi-Valued Fields
Multi-valued fields are fields that allow for multiple values in them. When using the website, there is a button that allows you to add another field. In the API, all you have to do is put a | between them. For example "related_url": "www.google.com|www.bing.com".
Example of Creating a Private Dataset with attached File
curl -X POST https://scholar-qa.uc.edu/api/concern/datasets -H 'api-key: APIKEY' -H 'Content-Type: multipart/form-data' -F title=Title -F email=[email protected] -F first_name=Glen -F last_name=Horton -F college=Libraries -F 'department=Program or Department' -F creator=Creator -F description=Description -F 'license=http://rightsstatements.org/vocab/InC/1.0/' -F 'attachments[][file]=@IMG_7755.JPG'