Appearance
API Importer
Exposes in /api/importer
the functionality of Importer.
Authentication
See cmsapi.
Authorization
There are no limits beyond the roles of the cms when operating.
Methods
A minimum reference can be obtained from:
shell
$ ./app/admin/console debug:router | grep api.importer
app_cmsadmin_apiimporter_getversion GET ANY ANY /api/importer/version
app_cmsadmin_apiimporter_importarticle POST ANY ANY /api/importer/articles
app_cmsadmin_apiimporter_exportarticle GET ANY ANY /api/importer/articles/{id}
app_cmsadmin_apiimporter_importarticle POST ANY ANY /api/importer/images
app_cmsadmin_apiimporter_exportarticle GET ANY ANY /api/importer/images/{id}
app_cmsadmin_apiimporter_importarticle POST ANY ANY /api/importer/users
app_cmsadmin_apiimporter_exportarticle GET ANY ANY /api/importer/users/{id}
app_cmsadmin_apiimporter_importarticle POST ANY ANY /api/importer/bulk
...
Or:
shell
$ ./app/admin/console debug:router | grep importer | perl -n -e '$_ =~ s/ +/ /g; print' | cut -d\ -f3,6 | sort
GET /api/importer/articles/{id}
GET /api/importer/boards/{slug}
GET /api/importer/categories
GET /api/importer/categories/{id}
GET /api/importer/images/{id}
GET /api/importer/users/{id}
GET /api/importer/version
POST /api/importer/articles
POST /api/importer/boards
POST /api/importer/bulk
POST /api/importer/categories
POST /api/importer/images
POST /api/importer/users
Testing
In general because of the transitivity of export/import, except perhaps for additional conditions and dependent entities, the following should work for any entity and any instance of origin and destination. The following should work for any entity and any instance of origin and destination:
shell
$ curl -s -H "Authorization: Bearer $TOKEN" http://admin.starbase.lo:8080/api/importer/images/2 | \
xmllint --format - | \
sed 's/<uuid>.*</<uuid>test'`date +%s`'</g' | \
tee temp.xml | \
curl -s -H "Authorization: Bearer $TOKEN" -Hcontent-type:application/xml -d @- \
http://admin.starbase.lo:8080/api/importer/images
<?xml version="1.0"?>
<item>
<success>1</success>
<imageId>6</imageId>
</item>
Remaining in temp.xml
the request:
xml
<?xml version="1.0"?>
<item>
<data>
<uuid>test1647254979</uuid>
<name>622b48a46cd7d.jpeg</name>
<description>622b48a46cd7d.jpeg</description>
<alt>piepiepiepiepie</alt>
<base64file>/9j/4AAQSkZJRgABAQAAAQAB...</base64file>
<title>nomnomnomnomnom</title>
<contentType>image</contentType>
</data>
<metadata/>
<type>image</type>
</item>