Skip to content

Instantly share code, notes, and snippets.

@twinge
Created September 11, 2009 20:24
Show Gist options
  • Save twinge/185541 to your computer and use it in GitHub Desktop.
Save twinge/185541 to your computer and use it in GitHub Desktop.
Creative Crash API
Create New Model:
target url: http://www.creativecrash.com/downloads/cg_publish
post parameters:
download[title]
download[version] (you do not have this field, so it is optional, but it would be a string with 3 places like '1.2.5')
download[category_id_list]
download[short_description]
download[description]
download[tag_list] (keywords in your tool)
download[price]
download[mature]
download[geometry]
download[polygons]
download[vertices]
download[materials]
download[textures]
download[animated]
download[rigged]
download[number_of_formats] (This tells me at the beginning how many file types will be sent)
Response to your system will look like this:
Success:
<download>
<id type="integer">226</id>
</download>
Errors:
<errors>
<error>Title can't be blank</error>
<error>Short description can't be blank</error>
<error>You must choose at least one category</error>
</errors>
Categories:
<option value="1121">Aircraft</option>
<option value="1140">Anatomy</option>
<option value="1131">Animals</option>
<option value="1127">Buildings</option>
<option value="1134">Cameras</option>
<option value="1139">Cars</option>
<option value="1126">Cities</option>
<option value="1128">Collections</option>
<option value="1120">Dental</option>
<option value="1123">Electronics</option>
<option value="1133">Furniture</option>
<option value="1142">Geography</option>
<option value="1132">Industrial</option>
<option value="1125">Military</option>
<option value="1138">Music</option>
<option value="1129">People</option>
<option value="1136">Plants</option>
<option value="1122">Ships</option>
<option value="1141">Space</option>
<option value="1137">Sports</option>
<option value="1135">Subs</option>
<option value="1124">Trucks</option>
<option value="1130">Weapons</option>
Sample curl post (be sure to replace username:password with your real account):
curl -v -H 'Accept: application/xml' --basic -u username:password -d 'download[title]=New%20Model&download[category_id_list]=1121&download[short_description]=mynewmodel&download[description]=longerdescription&download[tag_list]=tag1&download[price]=20&download[mature]=0&download[geometry]=Polygonal&download[polygons]=5&download[vertices]=4&download[materials]=1&download[textures]=0&download[animated]=1&download[rigged]=1&download[number_of_formats]=3' http://www.creativecrash.com/downloads/cg_publish
==================
Upload a Thumbnail:
target url: http://www.creativecrash.com/assets/cg_thumbnail
post parameters:
item_id (use the ID returned when the model was created)
file (the actual file being uploaded.)
Sample curl post:
curl -v -H 'Accept: application/xml' --basic -u username:password -F 'item_id=11971' -F 'file=@picture2.jpg' http://www.creativecrash.com/assets/cg_thumbnail
Response to your system will look like this:
Success:
<?xml version="1.0" encoding="UTF-8"?>
<asset>
<attachable-id type="integer">11971</attachable-id>
<attachable-type>Item</attachable-type>
<avatar type="boolean">false</avatar>
<created-at type="datetime">2009-09-15T10:44:44-05:00</created-at>
<deleted-at type="datetime" nil="true"></deleted-at>
<download-content-type nil="true"></download-content-type>
<download-file-name nil="true"></download-file-name>
<download-file-size type="integer" nil="true"></download-file-size>
<id type="integer">35</id>
<oversized type="boolean">false</oversized>
<photo-content-type>application/octet-stream</photo-content-type>
<photo-file-name>picture2.png</photo-file-name>
<photo-file-size type="integer">45579</photo-file-size>
<updated-at type="datetime">2009-09-15T10:44:44-05:00</updated-at>
<version nil="true"></version>
<version-info nil="true"></version-info>
</asset>
Errors:
<errors>
<error>No file was attached.</error>
</errors>
==================
Upload a File:
target url: http://www.creativecrash.com/formats/create.xml
post parameters:
file[download_id] (use the ID returned when the model was created)
file[zip] (the actual file being uploaded. we prefer .zip, but will handle whatever you send)
file[format_type_id] (see the list below mapping format types to format_type_id)
file[version]
Sample curl post:
curl -v -H 'Accept: application/xml' --basic -u username:password -F 'file[download_id]=11971' -F 'file[format_type_id]=4' -F 'file[version]=2010' -F 'file[zip]=@asdf.zip' http://www.creativecrash.com/formats
Format Types (i generated this from your list on the forum):
<option value="3">3D Studio (.3ds)</option>
<option value="4">3D Studio Project</option>
<option value="5">3ds Max (.max)</option>
<option value="6">Alias StudioTools</option>
<option value="7">Alias Wire (.wire)</option>
<option value="1">ASCII (.asc)</option>
<option value="2">ASCII (.xgl, .zgl)</option>
<option value="8">AutoCAD drawing (.dwg)</option>
<option value="9">Autodesk DWF (.dwf)</option>
<option value="10">Autodesk FBX (.fbx)</option>
<option value="11">Autodesk Inventor (.ipt, .iam)</option>
<option value="12">Blender (.blend)</option>
<option value="13">Bryce (.br4)</option>
<option value="14">Bryce (.obp)</option>
<option value="15">Catia</option>
<option value="16">Character Studio Biped (.bip)</option>
<option value="17">Cinema 4D (.c4d)</option>
<option value="18">Collada (.dae)</option>
<option value="19">DirectX (.X)</option>
<option value="20">DXF (.dxf)</option>
<option value="21">Electric Image (.eim, .fac)</option>
<option value="22">formZ (.fmz)</option>
<option value="23">gmax (.gmax)</option>
<option value="24">IGES (.ige, .igs, .iges)</option>
<option value="25">JSR-184 (.m3g)</option>
<option value="26">Lightwave (.lwo, .lw, .lws)</option>
<option value="27">Luxology Modo (.lxo)</option>
<option value="28">Maya (.ma, .mb)</option>
<option value="29">Microsoft DirectDraw Surface (.dds)</option>
<option value="30">MicroStation Drawing File (.dgn)</option>
<option value="31">Mudbox (.mud)</option>
<option value="32">OBJ (.obj)</option>
<option value="33">OpenFlight (.flt)</option>
<option value="34">OpenInventor (.iv)</option>
<option value="35">Parasolid (.x_t, .x_b)</option>
<option value="36">Poser (.pp2)</option>
<option value="37">Poser (.pz3)</option>
<option value="38">ProE Assembly (.asm, .xas)</option>
<option value="39">ProE Part (.prt, .xpr)</option>
<option value="40">Pulse (.pwc)</option>
<option value="41">Quake III (.md3)</option>
<option value="42">Quickdraw 3D (.3dmf)</option>
<option value="43">Realsoft 3D (.r3d)</option>
<option value="44">Renderman (.rib, .slc, .sl, .slo)</option>
<option value="45">Revit Design (.rvt)</option>
<option value="46">Revit Family (.rfa)</option>
<option value="47">Rhino (.3dm)</option>
<option value="48">Shade (.shd)</option>
<option value="49">Shockwave 3D (.w3d)</option>
<option value="50">SketchUp (.skp)</option>
<option value="51">Softimage (.hrc)</option>
<option value="52">Softimage (.xsi)</option>
<option value="53">Solidworks Assembly (.sldasm)</option>
<option value="54">Solidworks Part (.sldprt)</option>
<option value="55">STEP (.stp, .step)</option>
<option value="56">StereoLithography (.stl)</option>
<option value="57">Strata 3D (.s3d)</option>
<option value="58">Textures (.tex, .jpg, .bmp, .etc)</option>
<option value="59">TrueSpace (.cob)</option>
<option value="60">TrueSpace (.scn)</option>
<option value="61">TrueSpace Object (.rsobj)</option>
<option value="62">TrueSpace Scene (.rsscn)</option>
<option value="63">Universal 3D (.u3d)</option>
<option value="64">VRML (.wrl)</option>
<option value="65">VRML (.wrz)</option>
<option value="66">Vue (.vue)</option>
<option value="67">ZBrush (.ztl)</option>
==================
After an upload, send a request to /downloads/cg_upload_complete to notify the system:
target url: http://www.creativecrash.com/downloads/cg_upload_complete/$item_id
This can just be a simple GET request to a url that includes the item id. E.g:
http://www.creativecrash.com/downloads/cg_upload_complete/11971
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment