PHP API - structure of $data and $filedata

Hi,

I’m trying to use PHP API to import items (and next media) into Omeka-S.

I can read an item and update “is_public” by positioning $data[‘o: is_public’] but I cannot modify other data for sample $data[‘dcterms: title’] or $data[‘o:title’].

$data and $filedata are arrays but what are their structures ?

Thank for your help

Actually I don’t know how to understand the following sentence:

The $data argument is an optional array of API request parameters.
(https://omeka.org/s/docs/developer/api/php_api/#api-manager)

If I try :

   $data = Array();
   $data["o:is_public"] = false;
   $item = $this->api->create('items',$data)->getContent();

The API add a new [[Untitled]] private item.

But when I add one of the following information in $data i still add a new [[Untitled]] private item.

$data["o:title"] = "Hello world!";
$data["dcterms:title"] = "Hello world!";
$data["dcterms:title"]["value"] = "Hello world!";
$data["dcterms:title"] = Array( "type" => "literal", "property_id" => 1, "property_label" => "Title",  "@value" => "Hello world!!");

Have you ever used the PHP API to create or modify items?
How to correctly build $data?

The required structure is documented at https://omeka.org/s/docs/developer/api/rest_api_reference/

The value of your dcterms:title key should be an array of arrays. Your last example is almost right, it just needs another outer array on the value side.

Thank you jflatnes for your responsiveness !

I was 3 characters away from the solution :

$data["dcterms:title"][0]  = Array( "type" => "literal", "property_id" => 1, "property_label" => "Title", "@value" => "Hello world!");

and I could easily add a media with url ingester

$data= Array("o:ingester" =>  "url", "ingest_url" => "http://localhost/image.jpg", "file_index" => "0", "o:item" => Array ("o:id" => $id));
$item = $this->api->create('media',$data)->getContent();

Thanks a lot