aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-11-15 17:08:42 +0100
committerRigel Kent <sendmemail@rigelk.eu>2018-11-15 17:09:25 +0100
commit8f9e8be1fc46ce1744ed6ff537ce2fb995fe7b58 (patch)
tree32d9e9fcf884c649a3721554a9b9f9cc7224f2e8 /support/doc
parent6385c0cb7f773f5212a96807468988e17dba1d6d (diff)
downloadPeerTube-8f9e8be1fc46ce1744ed6ff537ce2fb995fe7b58.tar.gz
PeerTube-8f9e8be1fc46ce1744ed6ff537ce2fb995fe7b58.tar.zst
PeerTube-8f9e8be1fc46ce1744ed6ff537ce2fb995fe7b58.zip
fix API spec on POST /videos/upload and provide Shell example
Diffstat (limited to 'support/doc')
-rw-r--r--support/doc/api/openapi.yaml42
1 files changed, 39 insertions, 3 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml
index c5bea99ac..666e48a41 100644
--- a/support/doc/api/openapi.yaml
+++ b/support/doc/api/openapi.yaml
@@ -116,12 +116,16 @@ paths:
116 x-code-samples: 116 x-code-samples:
117 - lang: JavaScript 117 - lang: JavaScript
118 source: | 118 source: |
119 fetch('https://peertube.cpy.re/api/v1/accounts/{name}/videos') 119 fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos')
120 .then(function(response) { 120 .then(function(response) {
121 return response.json() 121 return response.json()
122 }).then(function(data) { 122 }).then(function(data) {
123 console.log(data) 123 console.log(data)
124 }) 124 })
125 - lang: Shell
126 source: |
127 # pip install httpie
128 http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos
125 /accounts: 129 /accounts:
126 get: 130 get:
127 tags: 131 tags:
@@ -131,7 +135,7 @@ paths:
131 '200': 135 '200':
132 description: successful operation 136 description: successful operation
133 content: 137 content:
134 'application/jsonhttps://peertube.cpy.re/api/v1': 138 'application/json':
135 schema: 139 schema:
136 type: array 140 type: array
137 items: 141 items:
@@ -730,6 +734,8 @@ paths:
730 previewfile: 734 previewfile:
731 description: Video preview file 735 description: Video preview file
732 type: string 736 type: string
737 privacy:
738 $ref: '#/components/schemas/VideoPrivacy'
733 category: 739 category:
734 description: Video category 740 description: Video category
735 type: string 741 type: string
@@ -764,6 +770,36 @@ paths:
764 required: 770 required:
765 - videofile 771 - videofile
766 - channelId 772 - channelId
773 - name
774 - privacy
775 x-code-samples:
776 - lang: Shell
777 source: |
778 ## DEPENDENCIES: httpie, jq
779 # pip install httpie
780 USERNAME="<your_username>"
781 PASSWORD="<your_password>"
782 FILE_PATH="<your_file_path>"
783 CHANNEL_ID="<your_channel_id>"
784 PRIVACY="1" # public: 1, unlisted: 2, private: 3
785 NAME="<video_name>"
786
787 API_PATH="https://peertube2.cpy.re/api/v1"
788 ## AUTH
789 client_id=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_id")
790 client_secret=$(http -b GET "$API_PATH/oauth-clients/local" | jq -r ".client_secret")
791 token=$(http -b --form POST "$API_PATH/users/token" \
792 client_id="$client_id" client_secret="$client_secret" grant_type=password response_type=code \
793 username=$USERNAME \
794 password=$PASSWORD \
795 | jq -r ".access_token")
796 ## VIDEO UPLOAD
797 http -b --form POST "$API_PATH/videos/upload" \
798 videofile@$FILE_PATH \
799 channelId=$CHANNEL_ID \
800 name=$NAME \
801 privacy=$PRIVACY \
802 "Authorization:Bearer $token"
767 /videos/abuse: 803 /videos/abuse:
768 get: 804 get:
769 summary: Get list of reported video abuses 805 summary: Get list of reported video abuses
@@ -1060,7 +1096,7 @@ paths:
1060 items: 1096 items:
1061 $ref: '#/components/schemas/Video' 1097 $ref: '#/components/schemas/Video'
1062servers: 1098servers:
1063 - url: 'https://peertube.cpy.re/api/v1' 1099 - url: 'https://peertube2.cpy.re/api/v1'
1064 description: Live Server 1100 description: Live Server
1065components: 1101components:
1066 parameters: 1102 parameters: