Aufruf
Alle Alvine-Cloud API Endpunkte sind in Postman dokumentiert.
Sie können die API direkt ausprobieren (externe Seite):
Environment
Die einzelnen API sind in Postman mit Platzhaltern angelegt. Die Platzhalter können über die Environment-Funktion gesetzt werden.
Platzhalter | Wert | Beschreibung |
---|---|---|
JUNO-URL | https://juno.alvine.cloud/ | Die URL des Services |
curl --location --request POST 'https://juno.alvine.cloud/api/v1/create' \
--header 'Accept: application/json' \
--header 'Authorization: api-key EVALUATION' \
--header 'Content-Type: application/json' \
--data-raw '{
"author": "schukai GmbH",
"title": "Demopaper",
"subject": "this is a example pdf",
"page-size": {
"unit": "mm",
"width": 291,
"height": 210
},
"fonts": [
{
"name": "RobotoX",
"url": "https://cdn.jsdelivr.net/npm/rubik-font@0.0.3/fonts/Rubik-Light.ttf",
"kerning": true
}
],
"templates": [
{
"url": "https://cdn.alvine.io/examples/alvine-cloud-website.pdf",
"page": 1,
"name": "website",
"box": "/MediaBox"
}
],
"pages": [
{
"outline": "This is a bookmark",
"objects": [
{
"type": "template",
"name": "website",
"x": 0,
"y": 0,
"width": 148
},
{
"type": "textbox",
"x1": 170,
"y1": 30,
"x2": 270,
"y2": 180,
"border": {
"color": {
"r": 255,
"g": 0,
"b": 0
}
},
"text": {
"text": "Text with Linefeed",
"valign": "top"
}
},
{
"type": "text",
"text": "Lorem ipsum dolor sit amet, consetetur\nsadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"x": 180,
"y": 50,
"font": "RobotoX",
"width": 80
},
{
"type": "image",
"url": "https://alvine.io/alvine.png",
"x": 5,
"y": 5,
"width": 40,
"height": 10
}
]
}
]
}'
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://juno.alvine.cloud/api/v1/create"
method := "POST"
payload := strings.NewReader(`{
"author": "schukai GmbH",
"title": "Demopaper",
"subject": "this is a example pdf",
"page-size": {
"unit": "mm",
"width": 291,
"height": 210
},
"fonts": [
{
"name": "RobotoX",
"url": "https://cdn.jsdelivr.net/npm/rubik-font@0.0.3/fonts/Rubik-Light.ttf",
"kerning": true
}
],
"templates": [
{
"url": "https://cdn.alvine.io/examples/alvine-cloud-website.pdf",
"page": 1,
"name": "website",
"box": "/MediaBox"
}
],
"pages": [
{
"outline": "This is a bookmark",
"objects": [
{
"type": "template",
"name": "website",
"x": 0,
"y": 0,
"width": 148
},
{
"type": "textbox",
"x1": 170,
"y1": 30,
"x2": 270,
"y2": 180,
"border": {
"color": {
"r": 255,
"g": 0,
"b": 0
}
},
"text": {
"text": "Text with Linefeed",
"valign": "top"
}
},
{
"type": "text",
"text": "Lorem ipsum dolor sit amet, consetetur\nsadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"x": 180,
"y": 50,
"font": "RobotoX",
"width": 80
},
{
"type": "image",
"url": "https://alvine.io/alvine.png",
"x": 5,
"y": 5,
"width": 40,
"height": 10
}
]
}
]
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "api-key EVALUATION")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "api-key EVALUATION");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"author": "schukai GmbH",
"title": "Demopaper",
"subject": "this is a example pdf",
"page-size": {
"unit": "mm",
"width": 291,
"height": 210
},
"fonts": [
{
"name": "RobotoX",
"url": "https://cdn.jsdelivr.net/npm/rubik-font@0.0.3/fonts/Rubik-Light.ttf",
"kerning": true
}
],
"templates": [
{
"url": "https://cdn.alvine.io/examples/alvine-cloud-website.pdf",
"page": 1,
"name": "website",
"box": "/MediaBox"
}
],
"pages": [
{
"outline": "This is a bookmark",
"objects": [
{
"type": "template",
"name": "website",
"x": 0,
"y": 0,
"width": 148
},
{
"type": "textbox",
"x1": 170,
"y1": 30,
"x2": 270,
"y2": 180,
"border": {
"color": {
"r": 255,
"g": 0,
"b": 0
}
},
"text": {
"text": "Text with Linefeed",
"valign": "top"
}
},
{
"type": "text",
"text": "Lorem ipsum dolor sit amet, consetetur\nsadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"x": 180,
"y": 50,
"font": "RobotoX",
"width": 80
},
{
"type": "image",
"url": "https://alvine.io/alvine.png",
"x": 5,
"y": 5,
"width": 40,
"height": 10
}
]
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://juno.alvine.cloud/api/v1/create", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://juno.alvine.cloud/api/v1/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"author": "schukai GmbH",
"title": "Demopaper",
"subject": "this is a example pdf",
"page-size": {
"unit": "mm",
"width": 291,
"height": 210
},
"fonts": [
{
"name": "RobotoX",
"url": "https://cdn.jsdelivr.net/npm/rubik-font@0.0.3/fonts/Rubik-Light.ttf",
"kerning": true
}
],
"templates": [
{
"url": "https://cdn.alvine.io/examples/alvine-cloud-website.pdf",
"page": 1,
"name": "website",
"box": "/MediaBox"
}
],
"pages": [
{
"outline": "This is a bookmark",
"objects": [
{
"type": "template",
"name": "website",
"x": 0,
"y": 0,
"width": 148
},
{
"type": "textbox",
"x1": 170,
"y1": 30,
"x2": 270,
"y2": 180,
"border": {
"color": {
"r": 255,
"g": 0,
"b": 0
}
},
"text": {
"text": "Text with Linefeed",
"valign": "top"
}
},
{
"type": "text",
"text": "Lorem ipsum dolor sit amet, consetetur\\nsadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"x": 180,
"y": 50,
"font": "RobotoX",
"width": 80
},
{
"type": "image",
"url": "https://alvine.io/alvine.png",
"x": 5,
"y": 5,
"width": 40,
"height": 10
}
]
}
]
}',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: api-key EVALUATION',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;