talk@lists.collectionspace.org

WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org

View all threads

Imports service will return additional info in v2.3

AR
Aron Roberts
Tue, Apr 10, 2012 4:07 PM

A change to the Imports service, to be included in v2.3, will return
additional data in the response:

  • Total records imported

  • Number of records imported by document (record) type (useful if you
    mix two or more document types within a single import file)

  • Individual elements containing the document type and CSID of each
    successfully reported record, in addition to the previously-provided
    text report of same

    A sample response, from POSTing a file to the Imports service that
    contained two Intake and two Object Exit records, is appended below.

    Since this represents a change that could affect your import
    scripts, wanted to give you a "head's up" on this.  AFAIK, these new
    fields should solely be additive, and existing fields should be
    unchanged.  There is one behavior that this change removes: the
    <report> tag / element no longer will sometimes return

Aron

P.S. This change was made to help support automated testing of the
Imports service; if it offers any side benefits for manual or scripted
imports, so much the better.

P.P.S. It's still painfully the case that the Imports service
sometimes returns 'SUCCESS' responses when it shouldn't.  There are
known JIRA issues to be resolved over time related to that.  With the
new format, you will now - hopefully - see
'<totalRecordsImported>0</totalRecordsImported>' if the import
completely failed to create new records; at least it did in one early
test when attempting to import a record into a non-existent 'Foo'
service.

--

<?xml version="1.0"?> <import> <msg>SUCCESS</msg> <importedRecords> <importedRecord> <doctype>Intake</doctype> <csid>4a74741a-1038-4709-aed7-f11b0488662a</csid> </importedRecord> <importedRecord> <doctype>ObjectExit</doctype> <csid>5ea68ca1-80d5-4b26-8b05-5d5a711391aa</csid> </importedRecord> <importedRecord> <doctype>Intake</doctype> <csid>01a9635b-4a80-44c2-b22d-49cb9a43884d</csid> </importedRecord> <importedRecord> <doctype>ObjectExit</doctype> <csid>5d68e4ff-b1fe-4b9b-b889-1b6c19f155c2</csid> </importedRecord> </importedRecords> <totalRecordsImported>4</totalRecordsImported> <numRecordsImportedByDocType> <numRecordsImported> <docType>Intake</docType> <numRecords>2</numRecords> </numRecordsImported> <numRecordsImported> <docType>ObjectExit</docType> <numRecords>2</numRecords> </numRecordsImported> </numRecordsImportedByDocType> <report>READ: /usr/local/share/apache-tomcat-6.0.33/temp/imports-e498509a-0524-49d3-89a1-203313590f5b/Intakes/01a9635b-4a80-44c2-b22d-49cb9a43884d/document.xml /Intakes/01a9635b-4a80-44c2-b22d-49cb9a43884d READ: /usr/local/share/apache-tomcat-6.0.33/temp/imports-e498509a-0524-49d3-89a1-203313590f5b/Intakes/4a74741a-1038-4709-aed7-f11b0488662a/document.xml /Intakes/4a74741a-1038-4709-aed7-f11b0488662a READ: /usr/local/share/apache-tomcat-6.0.33/temp/imports-e498509a-0524-49d3-89a1-203313590f5b/ObjectExit/5d68e4ff-b1fe-4b9b-b889-1b6c19f155c2/document.xml /ObjectExit/5d68e4ff-b1fe-4b9b-b889-1b6c19f155c2 READ: /usr/local/share/apache-tomcat-6.0.33/temp/imports-e498509a-0524-49d3-89a1-203313590f5b/ObjectExit/5ea68ca1-80d5-4b26-8b05-5d5a711391aa/document.xml /ObjectExit/5ea68ca1-80d5-4b26-8b05-5d5a711391aa </report> </import>
A change to the Imports service, to be included in v2.3, will return additional data in the response: * Total records imported * Number of records imported by document (record) type (useful if you mix two or more document types within a single import file) * Individual elements containing the document type and CSID of each successfully reported record, in addition to the previously-provided text report of same A sample response, from POSTing a file to the Imports service that contained two Intake and two Object Exit records, is appended below. Since this represents a change that could affect your import scripts, wanted to give you a "head's up" on this. AFAIK, these new fields should solely be additive, and existing fields should be unchanged. There is one behavior that this change removes: the <report> tag / element no longer will sometimes return Aron P.S. This change was made to help support automated testing of the Imports service; if it offers any side benefits for manual or scripted imports, so much the better. P.P.S. It's still painfully the case that the Imports service sometimes returns 'SUCCESS' responses when it shouldn't. There are known JIRA issues to be resolved over time related to that. With the new format, you will now - hopefully - see '<totalRecordsImported>0</totalRecordsImported>' if the import completely failed to create new records; at least it did in one early test when attempting to import a record into a non-existent 'Foo' service. -- <?xml version="1.0"?> <import> <msg>SUCCESS</msg> <importedRecords> <importedRecord> <doctype>Intake</doctype> <csid>4a74741a-1038-4709-aed7-f11b0488662a</csid> </importedRecord> <importedRecord> <doctype>ObjectExit</doctype> <csid>5ea68ca1-80d5-4b26-8b05-5d5a711391aa</csid> </importedRecord> <importedRecord> <doctype>Intake</doctype> <csid>01a9635b-4a80-44c2-b22d-49cb9a43884d</csid> </importedRecord> <importedRecord> <doctype>ObjectExit</doctype> <csid>5d68e4ff-b1fe-4b9b-b889-1b6c19f155c2</csid> </importedRecord> </importedRecords> <totalRecordsImported>4</totalRecordsImported> <numRecordsImportedByDocType> <numRecordsImported> <docType>Intake</docType> <numRecords>2</numRecords> </numRecordsImported> <numRecordsImported> <docType>ObjectExit</docType> <numRecords>2</numRecords> </numRecordsImported> </numRecordsImportedByDocType> <report>READ: /usr/local/share/apache-tomcat-6.0.33/temp/imports-e498509a-0524-49d3-89a1-203313590f5b/Intakes/01a9635b-4a80-44c2-b22d-49cb9a43884d/document.xml /Intakes/01a9635b-4a80-44c2-b22d-49cb9a43884d READ: /usr/local/share/apache-tomcat-6.0.33/temp/imports-e498509a-0524-49d3-89a1-203313590f5b/Intakes/4a74741a-1038-4709-aed7-f11b0488662a/document.xml /Intakes/4a74741a-1038-4709-aed7-f11b0488662a READ: /usr/local/share/apache-tomcat-6.0.33/temp/imports-e498509a-0524-49d3-89a1-203313590f5b/ObjectExit/5d68e4ff-b1fe-4b9b-b889-1b6c19f155c2/document.xml /ObjectExit/5d68e4ff-b1fe-4b9b-b889-1b6c19f155c2 READ: /usr/local/share/apache-tomcat-6.0.33/temp/imports-e498509a-0524-49d3-89a1-203313590f5b/ObjectExit/5ea68ca1-80d5-4b26-8b05-5d5a711391aa/document.xml /ObjectExit/5ea68ca1-80d5-4b26-8b05-5d5a711391aa </report> </import>
AR
Aron Roberts
Tue, Apr 10, 2012 4:31 PM

On Tue, Apr 10, 2012 at 9:07 AM, Aron Roberts
aron@socrates.berkeley.edu wrote:

 There is one behavior that this [Imports POST results] change removes:
the <report> tag / element no longer will sometimes return

Adding the missing piece:

Now the <reports> tag will no longer report "NO RESULTS".  If your
scripts relied on that, please let me know, and we can discuss whether
to add that back, or what new elements might substitute for that.

On Tue, Apr 10, 2012 at 9:07 AM, Aron Roberts <aron@socrates.berkeley.edu> wrote: >  There is one behavior that this [Imports POST results] change removes: > the <report> tag / element no longer will sometimes return Adding the missing piece: Now the <reports> tag will no longer report "NO RESULTS". If your scripts relied on that, please let me know, and we can discuss whether to add that back, or what new elements might substitute for that.