Web2web Upload API

This API enables website that manage 3D content to give their users the opportunity to push easily 3D content to the Sculpteo platform.

WorkFlow

This API does not require the content server to implement webservice directly. As such, it is very simple to implement and easily ported to any kind of content server. The idea is that the end-user web browser will issue a POST with informations about the design to be uploaded on the Sculpteo platform. The Sculpteo platform will then retrieve 3D content from the content server, using URL provided in the POST. In order to use the web2web API, you will need a provider account. Please contact us to create one and receive the shared secret used to validate form data.

Details

End-user browser will issue a POST to :

URL PATH

/{LANGUAGE_CODE}/backend/webapi/post_design/ (today languages code supported are en and fr)

The following variables are POSTed (fields marked with * are mandatory).

version*

1 (the version number)

email

email of the user

name*

the name of the design (not user).

urlfile1*

the url of the 3D file. It might be a zip containing the various files, or a single file in a file format we support on the platform. The maximum size is 500MB.

urlfile2

the url of an auxiliary file (a texture file for example). Usage of this variable is not recommanded, we recommand instead to create a zip with all necessary files. The maximum size is 500MB.

provider*

the username of the provider of the design

addtocart

list of uuids of designs to add to the cart simultaneously (comma separated)

unit

the default unit of the design, one of ‘mm’, ‘cm’, ‘m’, ‘in’, ‘ft’, ‘yd’

scale

the default scale of the design, in floating point format

description

the description of the design

material

the default printing material of the design

sizes

list of fixed scales, in order to fix orderable sizes of the design. Comma separated list of floats. If not present, user is free to select the size he wants.

materials

list of materials, in order to limit the choice of materials in which the design can be printed. Comma separated list of materials (see below for material values). If not present, user is free to select the material he wants.

list

optional design list uuid to which the design will be assigned

hash*

is a security hash, that will sign your datas using your password.

Specifications and examples in php and python on how to compute the hash is available in Hash computation.

If unit and scale is unset, the unit is assumed to be centimeters, the default printing material is automatically detected depending on file format, and the default scale is automatically determined to fit into the default printer for this printing material. If you use the unit or scale parameter, automatic fitting is disabled, so make sure your design is not too large or too small.

If material is unset, the default material will be white plastic or multicolor depending on 3D file format. Otherwise, material may be chosen among the supported Materials.

The following html form will issue a correct POST :

<form action="https://www.sculpteo.com/en/backend/webapi/post_design/" method="post">
  <div style="display:none">
       <input type="text" name="version" value="1"/>
       <input type="text" name="email" value="[email protected]"/>
       <input type="text" name="name" value="Beautiful Design" />
       <input type="text" name="urlfile1" value="http://www.example.com/media/3dcontent/design.stl" />
       <input type="text" name="provider" value="TestProvider" />
       <input type="text" name="hash" value="0123456789abcdef" />
  </div>
  <input type="submit" value="Buy this design at sculpteo ! " />
</form>

When submitting the form, the end-user will be directed to the sculpteo platform, and the download of the 3D content will start directly between sculpteo platform and the www.example.com website. End-user may then need to enter some informations, such as accepting terms and conditions and eventually its personal information so that the Sculpteo platform is able to create an account for him.

Hash computation

The Web2web Upload API uses a hash to secure the origin of the design file, as well as other informations. It is a sha1 of a string concatenating all variables sent (name=value pairs, separated by “:” sign; for order of the fields, see Details), as well as a hash of the password of the Provider Account.

Hash is computed in php like this :

#!/usr/bin/php
<?php
$secret="password";
$email="[email protected]";
$name="design";
$urlfile1="http://www.example.org/3dcontent/scene.obj";
$urlfile2="http://www.example.org/3dcontent/scene.mtl";
$provider="provider";
$addtocart="1234567890";
$unit="mm";
$scale="1.0";
$description="Example description.";
$material="silver";


// Compute shared secret hash
$hash_secret=sha1($secret);

// String concatenating all variables in name=value pairs
$str= "version=1:email=$email:name=$name:urlfile1=$urlfile1:urlfile2=$urlfile2:provider=$provider:addtocart=$addtocart:unit=$unit:scale=$scale:description=$description:material=$material:secret=$hash_secret";
// (if some variable were not present, just skip the block name=value)

echo "$str\n";

// Compute signature
$hash=sha1($str);

// Print result
echo "$hash\n";
?>

Hash is computed in python like this :

import hashlib

# Data from this example
secret = "password"
email = "[email protected]"
name = "design"
urlfile1 = "http://www.example.org/3dcontent/scene.obj"
urlfile2 = "http://www.example.org/3dcontent/scene.mtl"
provider = "provider"
addtocart = "0123456789"
unit = "mm"
sizes = "0.5,1.0"
description = "Example description."
material = "silver"

# Compute shared secret hash
hash_secret = hashlib.sha1()
hash_secret.update(secret.encode("utf-8"))
hsecret = hash_secret.hexdigest()
print(hsecret)

# String concatenating all variables in name=value pairs
str = (
    "version=1:email=%s:name=%s:urlfile1=%s:urlfile2=%s:provider=%s:addtocart=%s:unit=%s:description=%s:material=%s:sizes=%s:secret=%s"
    % (
        email,
        name,
        urlfile1,
        urlfile2,
        provider,
        addtocart,
        unit,
        description,
        material,
        sizes,
        hsecret,
    )
)
# (if some variable were not present, just skip the block name=value)

# Compute the signature
m = hashlib.sha1()
m.update(str.encode("utf-8"))
print(str)

# Print result
print(m.hexdigest())

Secret key $secret is the shared secret for your provider account (on the test platform it will be “password”). Please contact us to get your secret key if you want to use the web2web API on our production platform.

Prev: Split 3D content and meta data Next: Embedding Sculpteo Web Components

» webapi documentation » Uploading Designs » Web2web Upload API

Last update: 1970-01-01 01:00 (CET)