This is the internal API for the REPLICATE project Content Server.

Requirements

To use the API you will need to be a registered user of the service.
Whilst REPLICATE is under development, only REPLICATE partners will be given access. (via e-mail)

Overview

Content Server API calls are via a RESTful API
The user and other management APIs require admin rights.

Authorisation and Authentication

All APIs require basic authorisation with a valid username and password.

Usage example (.NET)

using

System.Text;

using

System.Net.Http;

//url is relative API url, for example "users?id=10"



string

GetAuthString(

string

username,

string

password)
{
    

string

auth = username +

":"

+ password;
    

return

Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(auth);
}

string

DoReplicateGet(

string

url)
{
    HttpClient client =

new

HttpClient();
    client.BaseAddress =

new

Uri(

"http://www.replicate3d.eu/api/"

);
    

string

auth = GetAuthString(

"myusername"

,

"mypassword"

);
    client.DefaultRequestHeaders.Authorization =
        

new

AuthenticationHeaderValue(

"Basic"

, auth);

    HttpResponseMessage resp = client.GetAsync(url).Result;
    

byte

[] content =

await

resp.Content.ReadAsByteArrayAsync();
    

return

Encoding.Default.GetString(content);
}

So to download model 1 in obj format, you would use:

DoreplicateGet(

"models?id=1&fmt=obj"

);


Usage example (Unity)

using

System.Text;

using

UnityEngine;

using

UnityEngine.Experimental.Networking;

string

GetAuthString(

string

username,

string

password)
{
    

string

auth = username +

":"

+ password;
    auth = System.Convert.ToBase64String(
        Encoding.GetEncoding(

"ISO-8859-1"

).GetBytes(auth));
    auth =

"Basic "

+ auth;
    

return

auth;
}

IEnumerator DoReplicateGet(

string

url)
{
    

string

auth = GetAuthString(

"myusername"

,

"mypassword"

);
    

string

url =

"http://www.replicate3d.eu/api/"

+url;

    UnityWebRequest www = UnityWebRequest.Get(url);
    www.SetRequestHeader(

"AUTHORIZATION"

, auth);

    yield

return

www.Send();
}