Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions docs/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ info:
version: 1.0.0
description: API for uploading files, creating conversion jobs, checking status, and downloading results.
servers:
- url: https://example.com/api/v1
description: Production
- url: http://localhost/api/v1
description: Local development
- url: /api/v1
description: Current host
paths:
/converters:
get:
Expand Down Expand Up @@ -394,7 +392,7 @@ components:
type: string
example: Quality
default:
nullable: true
type: ['string', 'null']
example: high
options:
type: array
Expand Down Expand Up @@ -586,8 +584,9 @@ components:
credits:
$ref: '#/components/schemas/CreditCost'
result_file:
nullable: true
$ref: '#/components/schemas/File'
anyOf:
- $ref: '#/components/schemas/File'
- type: 'null'
created_at:
type: string
format: date-time
Expand Down
14 changes: 7 additions & 7 deletions resources/views/docs/api.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@
<h2>curl examples</h2>

<p><strong>1. Upload a file</strong></p>
<pre><code>curl -X POST "https://example.com/api/v1/files" \
<pre><code>curl -X POST "{{ url('/api/v1/files') }}" \
-H "Authorization: Bearer fc_live_xxx" \
-F "file=@product-photo.png"</code></pre>

<p><strong>2. List target formats</strong></p>
<pre><code>curl -X GET "https://example.com/api/v1/files/file_01HX7abc/targets" \
<pre><code>curl -X GET "{{ url('/api/v1/files/file_01HX7abc/targets') }}" \
-H "Authorization: Bearer fc_live_xxx"</code></pre>

<p><strong>3. Estimate conversion cost</strong></p>
<pre><code>curl -X POST "https://example.com/api/v1/conversions/estimate" \
<pre><code>curl -X POST "{{ url('/api/v1/conversions/estimate') }}" \
-H "Authorization: Bearer fc_live_xxx" \
-H "Content-Type: application/json" \
-d '{"file_id": "file_01HX7abc", "target_format": "jpg"}'</code></pre>

<p><strong>4. Create a conversion</strong></p>
<pre><code>curl -X POST "https://example.com/api/v1/conversions" \
<pre><code>curl -X POST "{{ url('/api/v1/conversions') }}" \
-H "Authorization: Bearer fc_live_xxx" \
-H "Content-Type: application/json" \
-d '{
Expand All @@ -74,19 +74,19 @@
}'</code></pre>

<p><strong>5. Poll conversion status</strong></p>
<pre><code>curl -X GET "https://example.com/api/v1/conversions/conv_01HX8abc" \
<pre><code>curl -X GET "{{ url('/api/v1/conversions/conv_01HX8abc') }}" \
-H "Authorization: Bearer fc_live_xxx"</code></pre>

<p><strong>6. Download the result</strong></p>
<pre><code>curl -L -X GET "https://example.com/api/v1/conversions/conv_01HX8abc/download" \
<pre><code>curl -L -X GET "{{ url('/api/v1/conversions/conv_01HX8abc/download') }}" \
-H "Authorization: Bearer fc_live_xxx" \
-o result.jpg</code></pre>

<hr class="divider">
</div>

<redoc spec-url="{{ route('docs.api.openapi') }}"></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
<script src="https://cdn.redoc.ly/redoc/2.x/bundles/redoc.standalone.js"></script>

</body>
</html>