Add notes for 2019-02-20

This commit is contained in:
2019-02-20 07:42:58 -08:00
parent 6c7339b805
commit ee38b0de9f
4 changed files with 47 additions and 14 deletions

View File

@ -979,4 +979,19 @@ Mozilla/5.0 (Linux; Android 7.0; TECNO Camon CX Build/NRD90M) AppleWebKit/537.36
- I wrote a quick and dirty Python script called `resolve-addresses.py` to resolve IP addresses to their owning organization's name, ASN, and country using the [IPAPI.co API](https://ipapi.co)
## 2019-02-20
- Ben Hack was asking about getting authors publications programmatically from CGSpace for the new ILRI website
- I told him that they should probably try to use the REST API's `find-by-metadata-field` endpoint
- The annoying thing is that you have to match the text language attribute of the field exactly, but it does work:
```
$ curl -s -H "accept: application/json" -H "Content-Type: application/json" -X POST "https://cgspace.cgiar.org/rest/items/find-by-metadata-field" -d '{"key": "cg.creator.id","value": "Alan S. Orth: 0000-0002-1735-7458", "language": ""}'
$ curl -s -H "accept: application/json" -H "Content-Type: application/json" -X POST "https://cgspace.cgiar.org/rest/items/find-by-metadata-field" -d '{"key": "cg.creator.id","value": "Alan S. Orth: 0000-0002-1735-7458", "language": null}'
$ curl -s -H "accept: application/json" -H "Content-Type: application/json" -X POST "https://cgspace.cgiar.org/rest/items/find-by-metadata-field" -d '{"key": "cg.creator.id","value": "Alan S. Orth: 0000-0002-1735-7458", "language": "en_US"}'
```
- This returns six items for me, which is the [same I see in a Discovery search](https://cgspace.cgiar.org/discover?filtertype_1=orcid&filter_relational_operator_1=contains&filter_1=Alan+S.+Orth%3A+0000-0002-1735-7458&submit_apply_filter=&query=)
- Hector Tobon from CIAT asked if it was possible to get item statistics from CGSpace so I told him to use my [dspace-statistics-api](https://github.com/ilri/dspace-statistics-api)
<!-- vim: set sw=2 ts=2: -->