Start Transfer via API Problem

46 views
Skip to first unread message

Benjamin Simonis

unread,
Jun 18, 2018, 6:53:32 AM6/18/18
to Archivematica Tech
Hello everyone,

I'm working with Archivematica since a half year right now and i wanted work more and more with the API. But at the moment I'm stucked with starting a transfer.
Everytime I try to start a transfer via API I get an Internal Server Error.

ERROR     2018-06-18 09:07:28  django.request:base:handle_uncaught_exception:256:  Internal Server Error: /api/transfer/start_transfer/
Traceback (most recent call last):
  File "/usr/share/archivematica/virtualenvs/archivematica-dashboard/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/share/archivematica/dashboard/components/api/views.py", line 73, in wrapper
    result = func(request, *args, **kwargs)
  File "/usr/share/archivematica/dashboard/components/api/views.py", line 272, in start_transfer_api
    response = filesystem_ajax_views.start_transfer(transfer_name, transfer_type, accession, paths, row_ids)
  File "/usr/share/archivematica/dashboard/components/filesystem_ajax/views.py", line 241, in start_transfer
    raise ValueError('No transfer name provided.')
ValueError: No transfer name provided.

 The JSON I sent looks like this:
{
    "name": "Tell",
    "type": "standard",
    "accession": 1231,
    "paths[]": [
        "MTUxMWVmOTItODY3MS00MzNiLTk4YTUtZGI2NGE0ZmNjNWU4Oi9tbnQvYXJjaGl2ZW1hdGljYS9zb3VyY2UvRmlyc3REaXI="
    ],
    "row_ids[]": [
        ""
    ]
}

As I can say it is very similar with the JSON from the API documentation or from the automation-tool I tested.

Could it be I missed something while forming this JSON? Or could it be a general setting problem on my side? GET and DELETE requests works fine. It is only a problem if I make a POST request with a JSON body.

Maybe already had the same problem like me, but I didn't find something in the user groups here.

I'm looking forward to get some help with this problem.

With kind regards,
Benjamin

Andrew Berger

unread,
Jun 19, 2018, 12:54:32 AM6/19/18
to Archivematica Tech
Hi Benjamin,

I don't know how to get the start transfer API working with JSON, but I have been using this command successfully with curl:

curl -s --data "username=$username&api_key=$apikey" --data "name=$transfer_name&type=$transfer_type" --data "paths[]=[$source_base64]" "http://$am_host/api/transfer/start_transfer/"

Andrew
Reply all
Reply to author
Forward
0 new messages