Hi Carlos,

It looks like your JSON request is wrongly formatted for creating a new item.  
Here's an example of the proper format for this JSON:

https://github.com/BrunoNZ/dspace-rest-requests/blob/master/requests/POST_new-items.sh#L7-L27

In general, that GitHub repo provides good examples for DSpace 6.x REST API.  
It also can be found linked from our docs at 
htt<https://wiki.lyrasis.org/display/DSDOC6x/REST+API#RESTAPI-AdditionalInformation>ps://wiki.lyrasis.org/display/DSDOC6x/REST+API#RESTAPI-AdditionalInformation<https://wiki.lyrasis.org/display/DSDOC6x/REST+API#RESTAPI-AdditionalInformation>

Tim
________________________________
From: [email protected] <[email protected]> on 
behalf of Carlos Franzreb <[email protected]>
Sent: Friday, June 19, 2020 7:52 AM
To: DSpace Community <[email protected]>
Subject: [dspace-community] DSpace REST API: creating a new item

Hello,

I am aware this is a very basic question, but I haven't found a solution to my 
problem. When attempting to post a new item into a collection, I get an error 
which I don't understand. Any help is appreciated. Thanks in advance

This is how my HTTP request looks like:
* Method: POST
* URL: 
https://www.weizenbaum-library.de/rest/collections/12e466f0-644a-4171-80a8-c55999888b5a/items
* Headers: {'User-Agent': 'python-requests/2.22.0', 'Accept-Encoding': 'gzip, 
deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 
'JSESSIONID=648854D9548288ED66E65A6A33E0D9A7', 'Content-Length': '174', 
'Content-Type': 'application/json', 'Authorization': 'Basic 
am9zZXBoOmZva3VzMjAyMCQk'}
* Body: b'[{"key": "dc.contributor.author", "value": "Mustermann, Max"}, 
{"key": "dc.title", "value": "API Test"}, {"key": "dc.description.abstract", 
"value": "Abstract of the paper"}]'

And this is the error I get as a response:
Can not deserialize instance of org.dspace.rest.common.Item out of START_ARRAY 
token
 at [Source: 
org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@438298c;
 line: 1, column: 1]

Best regards,
Carlos

--
All messages to this mailing list should adhere to the DuraSpace Code of 
Conduct: https://duraspace.org/about/policies/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups 
"DSpace Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-community/3583ec6a-698a-4942-9754-a53bdd5debeeo%40googlegroups.com<https://groups.google.com/d/msgid/dspace-community/3583ec6a-698a-4942-9754-a53bdd5debeeo%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
All messages to this mailing list should adhere to the DuraSpace Code of 
Conduct: https://duraspace.org/about/policies/code-of-conduct/
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-community/DM5PR2201MB1148D656ED84B6838295711CED970%40DM5PR2201MB1148.namprd22.prod.outlook.com.

Reply via email to