Commit
·
ea74529
1
Parent(s):
caf7189
add call via api specs
Browse files
docs/deploy-pipelines/_category_.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"label": "Deploy pipelines & API",
|
| 3 |
+
"position": 4,
|
| 4 |
+
"link": {
|
| 5 |
+
"type": "generated-index",
|
| 6 |
+
"description": "Simply deploy your pipelines & call via API."
|
| 7 |
+
}
|
| 8 |
+
}
|
docs/deploy-pipelines/call-via-api.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
sidebar_position: 1
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Call via API
|
| 6 |
+
|
| 7 |
+
Once deployed, your pipelines can be called with POST/GET requests.
|
| 8 |
+
|
| 9 |
+
:::tip Tip
|
| 10 |
+
|
| 11 |
+
If you've deployed Piper on your own server, replace **piper.my** with your domain name.
|
| 12 |
+
|
| 13 |
+
:::
|
| 14 |
+
|
| 15 |
+
## Run pipeline
|
| 16 |
+
|
| 17 |
+
```bash
|
| 18 |
+
curl --location --request POST 'https://piper.my/api/pipeline-slug/launch' \
|
| 19 |
+
--header 'content-type: application/json' \
|
| 20 |
+
--header 'api-token: [YOUR_API_KEY_HERE]' \
|
| 21 |
+
--data '{
|
| 22 |
+
"inputs": {
|
| 23 |
+
name: "Bob Marley",
|
| 24 |
+
age: 36,
|
| 25 |
+
died: true
|
| 26 |
+
}
|
| 27 |
+
}'
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
:::tip Important
|
| 31 |
+
|
| 32 |
+
Input type could only primitive: `boolean` | `number` | `string`
|
| 33 |
+
|
| 34 |
+
:::
|
| 35 |
+
|
| 36 |
+
Some pipelines accept JSON as input.
|
| 37 |
+
|
| 38 |
+
In this case, the JSON must still be serialized into a string.
|
| 39 |
+
|
| 40 |
+
```json
|
| 41 |
+
{
|
| 42 |
+
"inputs": {
|
| 43 |
+
"props": "{ \"name\": \"Bob Marley\", \"age\": 36 }"
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
### Images & Media types
|
| 49 |
+
|
| 50 |
+
There are two ways to send images and other media like videos or audio:
|
| 51 |
+
1. JSON Base64: `data:image/jpeg;base64,...`
|
| 52 |
+
2. Uploading as an artefact.
|
| 53 |
+
|
| 54 |
+
#### JSON Base64
|
| 55 |
+
|
| 56 |
+
```bash
|
| 57 |
+
curl --location --request POST 'https://piper.my/api/pipeline-slug/launch' \
|
| 58 |
+
--header 'content-type: application/json' \
|
| 59 |
+
--header 'api-token: [YOUR_API_KEY_HERE]' \
|
| 60 |
+
--data '{
|
| 61 |
+
"inputs": {
|
| 62 |
+
image: "data:image/jpeg;base64,..."
|
| 63 |
+
}
|
| 64 |
+
}'
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
:::danger Limits
|
| 68 |
+
|
| 69 |
+
For stability and performance reasons, JSON payloads are limited to 2048 KB.
|
| 70 |
+
For large media files, please upload them as artifacts.
|
| 71 |
+
|
| 72 |
+
:::
|
| 73 |
+
|
| 74 |
+
#### Uploading artefact
|
| 75 |
+
|
| 76 |
+
Piper has its own temporary storage for handling large media files.
|
| 77 |
+
|
| 78 |
+
```bash
|
| 79 |
+
curl --location --request POST 'https://piper.my/api/artefacts' \
|
| 80 |
+
--header 'api-token: [YOUR_API_KEY_HERE]' \
|
| 81 |
+
-F "file=@/path/to/your/file.jpg"
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
After the upload, you will receive a URL to access the file.
|
| 85 |
+
|
| 86 |
+
:::danger Limits
|
| 87 |
+
|
| 88 |
+
Your file will be deleted automatically after ~48 hours.
|
| 89 |
+
|
| 90 |
+
:::
|
| 91 |
+
|
| 92 |
+
## Pipeline status
|
| 93 |
+
|
| 94 |
+
```bash
|
| 95 |
+
curl --location --request GET 'https://piper.my/api/launches/[LAUNCH_ID]/state' \
|
| 96 |
+
--header 'api-token: [YOUR_API_KEY_HERE]'
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
Depending on the pipeline type, we recommend polling every 2–5 seconds.
|
| 100 |
+
|
| 101 |
+
Since outputs in a pipeline are set asynchronously, you need to wait for all the outputs you're expecting.
|
| 102 |
+
|
| 103 |
+
:::tip Question
|
| 104 |
+
|
| 105 |
+
> Do you support webhooks or streaming events?
|
| 106 |
+
|
| 107 |
+
**It's coming very soon!**
|
| 108 |
+
|
| 109 |
+
Please vote for the [related issue](https://github.com/my-piper/piper/issues/17) to show your support.
|
| 110 |
+
|
| 111 |
+
:::
|
docs/tutorial-basics/_category_.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"label": "
|
| 3 |
"position": 2,
|
| 4 |
"link": {
|
| 5 |
"type": "generated-index",
|
|
|
|
| 1 |
{
|
| 2 |
+
"label": "Pipeline Basics",
|
| 3 |
"position": 2,
|
| 4 |
"link": {
|
| 5 |
"type": "generated-index",
|
docs/tutorial-extras/_category_.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"label": "
|
| 3 |
"position": 3,
|
| 4 |
"link": {
|
| 5 |
"type": "generated-index"
|
|
|
|
| 1 |
{
|
| 2 |
+
"label": "Advanced development",
|
| 3 |
"position": 3,
|
| 4 |
"link": {
|
| 5 |
"type": "generated-index"
|