EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #07078


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Q: Updating fields using the REST API


Thanks, I'll try that next. I've started to read through the Perl (I'm a bit rusty) to understand the details too.  When I solve it I'll post something to the list hear as I notice this crops up everyone year or two.

All the best,

Robert Doiel

On Wed, Jan 10, 2018 at 3:27 AM, Christopher Gutteridge <cjg@ecs.soton.ac.uk> wrote:

I think you might have to put a whole field at a time, but it's many years since I've looked at this so it may have changed!

I'm guessing you can get the syntax via: GET /authors/rest/eprint/1/creators



On 08/01/2018 23:46, rsdoiel@caltech.edu wrote:
CRUD operations on the EPrints 3.3.15 REST API

Happy New years everyone,

I have a question about using the REST API to update an EPrints collection (EPrints 3.3.15).
I'd like to update the value of the ID field for /rest/eprint/#####/creators/#####/id.txt
and when I try to put (id.txt currently is empty) I get an error
like

    curl -v -u epautomation:testrepo -d "Moore-R-L" -X PUT http://lemurprints.local/authors/rest/eprint/1/creators/1/id.txt
    *   Trying 172.28.128.4...
    * TCP_NODELAY set
    * Connected to lemurprints.local (172.28.128.4) port 80 (#0)
    * Server auth using Basic with user 'epautomation'
    > PUT /authors/rest/eprint/1/creators/1/id.txt HTTP/1.1
    > Host: lemurprints.local
    > Authorization: Basic ZXBhdXRvbWF0aW9uOnRlc3RyZXBv
    > User-Agent: curl/7.57.0
    > Accept: */*
    > Content-Length: 9
    > Content-Type: application/x-www-form-urlencoded
    >
    * upload completely sent off: 9 out of 9 bytes
    < HTTP/1.1 501 Method PUT Not Implemented
    < Date: Mon, 08 Jan 2018 23:36:53 GMT
    < Server: Apache/2.4.7 (Ubuntu)
    < Content-Length: 0
    < Connection: close
    <
    * Closing connection 0

Doing a similar command to changed the "referred" field does work (flipping the value from TRUE to FALSE).

    curl -v -u epautomation:testrepo -d "TRUE" -X PUT http://lemurprints.local/authors/rest/eprint/1/refereed.txt
    *   Trying 172.28.128.4...
    * TCP_NODELAY set
    * Connected to lemurprints.local (172.28.128.4) port 80 (#0)
    * Server auth using Basic with user 'epautomation'
    > PUT /authors/rest/eprint/1/refereed.txt HTTP/1.1
    > Host: lemurprints.local
    > Authorization: Basic ZXBhdXRvbWF0aW9uOnRlc3RyZXBv
    > User-Agent: curl/7.57.0
    > Accept: */*
    > Content-Length: 4
    > Content-Type: application/x-www-form-urlencoded
    >
    * upload completely sent off: 4 out of 4 bytes
    < HTTP/1.1 200 OK
    < Date: Mon, 08 Jan 2018 23:42:56 GMT
    < Server: Apache/2.4.7 (Ubuntu)
    < Cache-Control: no-store, no-cache, must-revalidate
    < Vary: Accept-Encoding
    < Transfer-Encoding: chunked
    < Content-Type: text/plain; charset=UTF-8
    <
    * Connection #0 to host lemurprints.local left intact

I am probably missing something obvious but any help would be appreciated.

Thanks,

Robert



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

-- 
Christopher Gutteridge -- http://users.ecs.soton.ac.uk/cjg

University of Southampton Open Data Service: http://data.southampton.ac.uk/
You should read our Web & Data Innovation blog: http://blogs.ecs.soton.ac.uk/webteam/