Cannot POST Mef-FIles trough API

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot POST Mef-FIles trough API

sulu
This post was updated on .
Hi.

*Bump*

Does anybody transfer MEF-Zips with the API?

I cobbled a POST request together with help of the GeoNetwork Api
Documentation.
Great feature btw!

Request is tried out via curl:
curl -v --user admin:admin -b /tmp/cookie \
-d file=@072159d2-c075-459c-9007-41cc94b06893.mef \
-X POST
"http://localhost:8900/geonetwork/srv/api/0.1/records?metadataType=METADATA&uuidProcessing=OVERWRITE&group=gruppe&category=&rejectIfInvalid=true&publishToAll=false&assignToCatalog=true&transformWith=_none_"
\
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "X-XSRF-TOKEN: ${XSRFTOKEN}"


Response:
* About to connect() to localhost port 8900 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8900 (#0)
* Server auth using Basic with user 'bbfn'
> POST
> /geonetwork/srv/api/0.1/records?metadataType=METADATA&uuidProcessing=OVERWRITE&group=gruppe&category=&rejectIfInvalid=true&publishToAll=false&assignToCatalog=true&transformWith=_none_
> HTTP/1.1
> Authorization: Basic YmJmbjpsdmFfYmJmbg==
> User-Agent: curl/7.29.0
> Host: localhost:8900
> Cookie: XSRF-TOKEN=652110ad-a96d-4f66-aad7-89b0677adf01
> accept: application/json
> Content-Type: application/json
> X-XSRF-TOKEN: 652110ad-a96d-4f66-aad7-89b0677adf01
> Content-Length: 45
>
* upload completely sent off: 45 out of 45 bytes
< HTTP/1.1 400
* Added cookie JSESSIONID="8691DDCC5103779783E04D1FFD66DE4F" for domain
localhost, path /geonetwork, expire 0
...
* Closing connection 0
{"message":"MultipartException","code":"unsatisfied_request_parameter","description":"The
current request is not a multipart request"}


Adding -H "content-type: multipart/form-data" did not maka a change.

Since MEF-Files are ZIP-Archives i expected something like -H "Content-Type:
application/zip" but that also changed nothing.

What did i wrong?

Cheers
Andy








--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoNetwork-users-f3860293.html


_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork
Reply | Threaded
Open this post in threaded view
|

Re: Cannot POST Mef-FIles trough API (Solved?)

sulu
This post was updated on .
I got it working but diffently as the /DOC/API suggests

The differences to the API-Example are highlighted in bold characters.

curl -v --user admin:admin -b /tmp/cookie \
-X POST
"http://localhost:8080/geonetwork/srv/api/0.1/records?category=&publishToAll=false&assignToCatalog=true&uuidProcessing=OVERWRITE&transformWith=_none_"
\
-H "Accept: application/json" \
-H "Content-Type: multipart/form-data" \
-H "X-XSRF-TOKEN: d9e25fd0-2c44-4a06-a1e1-cd2fb6afd42f" \
-F "file=@0533859d-4542-4f64-b189-dc3c35bff151.mef"




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoNetwork-users-f3860293.html


_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork