+ Start a Discussion
Fabian Peters 8Fabian Peters 8 

Get schema definition (XSD) from BULK API

Hi everyone,

it is possible to retrieve query results trough BULK API as an xml document. However there seems no chance to get a corresponding schema definition (xsd), which is likely to be required for integrations with other systems.

I'm thankful for any ideas!
john yungkjohn yungk
Fabian,

Yes, query results can be retrieved as XML.

The last time I looked, XML results from a query are not included in AsyncApi.xsd, so I created a schema that represented the results I was seeing and called it AsyncApi_Missing.xsd. Note that this does include AsyncApi.xsd.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema 
	targetNamespace="http://www.force.com/2009/06/asyncapi/dataload" 
	elementFormDefault="qualified" 
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   	xmlns:tns="http://www.force.com/2009/06/asyncapi/dataload">
   	<xsd:include schemaLocation="AsyncApi.xsd" />
 	<xsd:element name="result-list" type="tns:ResultList" />
 	<xsd:complexType name="ResultList">
  		<xsd:sequence>
   			<xsd:element name="result" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
  		</xsd:sequence>
 	</xsd:complexType>
  	<xsd:element name="sObjects" type="tns:sObjectList" />
 	<xsd:complexType name="sObjectList">
  		<xsd:sequence>
   			<xsd:element name="sObject" type="tns:sObject" minOccurs="0" maxOccurs="unbounded" />
  		</xsd:sequence>
 	</xsd:complexType>
</xsd:schema>

Good luck,
John
 
Fabian Peters 8Fabian Peters 8
Hi John,

thank you very much for your reply!

This is a good solution if the queried fields always remain the same. However I query fields via Schema, so my query and the corresponding xml result is dynamic. I would need a solution which can provide xsd to changing xml.

Regards,
Fabian
john yungkjohn yungk
The queryList contains a set of records and each records element is an sObject, but the async schema treats an sObject in a similar manner as the partner WSDL in that it's a generic object.