Last active
March 18, 2021 09:10
-
-
Save DaRaFF/42f243220cdb83f81e98d308d9278d1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DESIGNNAME=${4:-"living-times"} | |
DESIGNVERSION=${5:-"1.0.2"} | |
echo "-------ARGUMENTS-------------" | |
echo "Generate documentId from: $1" | |
echo "Generate documentId to: $2" | |
echo "Title postfix: $3" | |
echo "Design name $DESIGNNAME" | |
echo "Desig version $DESIGNVERSION" | |
echo "-----------------------------" | |
for ((i = $1; i <= $2; i++)); do | |
echo "import article with id $i" | |
CHECKSUM=$((1 + RANDOM % 1000000)) | |
curl -k -X POST "https://0.0.0.0:9000/proxy/api/api/v1/import/documents" \ | |
-H "Accept: application/json" \ | |
-H "Authorization: Bearer $ACCESS_TOKEN" \ | |
-H 'Content-Type: application/json; charset=utf-8' \ | |
--data-binary @- << EOF | |
{ | |
"systemName": "identifier-for-your-system", | |
"webhook": "https://webhook.site/c87057b1-0224-42bb-984c-5eab3ad3744d", | |
"documents": [ { | |
"id": "$i", | |
"title": "this is document $i $3", | |
"contentType": "regular", | |
"checksum": "$i$CHECKSUM", | |
"livingdoc": { | |
"content": [ | |
{ | |
"identifier": "living-times.article-container", | |
"id": "doc-1e9db5b440", | |
"position": "fixed", | |
"containers": { | |
"header": [ | |
{ | |
"identifier": "living-times.head", | |
"id": "doc-1e9db5b450", | |
"content": { | |
"title": "this is document $i $3", | |
"text": "this is a automatically generated article via public api import", | |
"author": "Sub Zero", | |
"date": "01.01.2000" | |
} | |
} | |
], | |
"main": [ | |
{ | |
"identifier": "living-times.image", | |
"id": "doc-1e9db5b460" | |
}, | |
{ | |
"identifier": "living-times.paragraph", | |
"id": "doc-1e9db5b470" | |
}, | |
{ | |
"identifier": "living-times.teaser-author", | |
"id": "doc-1e9db5b471", | |
"content": { | |
"embed": { | |
"service": "teaser", | |
"params": { | |
"layout": "author-embed" | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
], | |
"design": { | |
"name": "$DESIGNNAME", | |
"version": "$DESIGNVERSION" | |
} | |
}, | |
"metadata": { | |
"description": "foo" | |
}, | |
"flags": { | |
"autoPublish": true | |
} | |
}] | |
} | |
EOF | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example how to import some fake document into Livingdocs
import.jobs.imageDailyLimit
// 100000import.jobs.documentDailyLimit
// 100000db.max
// 20