Products
Update Files
Update the files associated with a product.
PUT
/
products
/
{id}
/
files
JavaScript
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: 'My Bearer Token',
});
const response = await client.products.updateFiles('id', { file_name: 'file_name' });
console.log(response.file_id);from dodopayments import DodoPayments
client = DodoPayments(
bearer_token="My Bearer Token",
)
response = client.products.update_files(
id="id",
file_name="file_name",
)
print(response.file_id)package main
import (
"context"
"fmt"
"github.com/dodopayments/dodopayments-go"
"github.com/dodopayments/dodopayments-go/option"
)
func main() {
client := dodopayments.NewClient(
option.WithBearerToken("My Bearer Token"),
)
response, err := client.Products.UpdateFiles(
context.TODO(),
"id",
dodopayments.ProductUpdateFilesParams{
FileName: dodopayments.F("file_name"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.FileID)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.products.ProductUpdateFilesParams;
import com.dodopayments.api.models.products.ProductUpdateFilesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ProductUpdateFilesParams params = ProductUpdateFilesParams.builder()
.id("id")
.fileName("file_name")
.build();
ProductUpdateFilesResponse response = client.products().updateFiles(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.products.ProductUpdateFilesParams
import com.dodopayments.api.models.products.ProductUpdateFilesResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: ProductUpdateFilesParams = ProductUpdateFilesParams.builder()
.id("id")
.fileName("file_name")
.build()
val response: ProductUpdateFilesResponse = client.products().updateFiles(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.products.update_files("id", file_name: "file_name")
puts(response)curl --request PUT \
--url https://test.dodopayments.com/products/{id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_name": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://test.dodopayments.com/products/{id}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'file_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Product Id
Body
application/json
Was this page helpful?
⌘I
JavaScript
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: 'My Bearer Token',
});
const response = await client.products.updateFiles('id', { file_name: 'file_name' });
console.log(response.file_id);from dodopayments import DodoPayments
client = DodoPayments(
bearer_token="My Bearer Token",
)
response = client.products.update_files(
id="id",
file_name="file_name",
)
print(response.file_id)package main
import (
"context"
"fmt"
"github.com/dodopayments/dodopayments-go"
"github.com/dodopayments/dodopayments-go/option"
)
func main() {
client := dodopayments.NewClient(
option.WithBearerToken("My Bearer Token"),
)
response, err := client.Products.UpdateFiles(
context.TODO(),
"id",
dodopayments.ProductUpdateFilesParams{
FileName: dodopayments.F("file_name"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.FileID)
}
package com.dodopayments.api.example;
import com.dodopayments.api.client.DodoPaymentsClient;
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
import com.dodopayments.api.models.products.ProductUpdateFilesParams;
import com.dodopayments.api.models.products.ProductUpdateFilesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();
ProductUpdateFilesParams params = ProductUpdateFilesParams.builder()
.id("id")
.fileName("file_name")
.build();
ProductUpdateFilesResponse response = client.products().updateFiles(params);
}
}package com.dodopayments.api.example
import com.dodopayments.api.client.DodoPaymentsClient
import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
import com.dodopayments.api.models.products.ProductUpdateFilesParams
import com.dodopayments.api.models.products.ProductUpdateFilesResponse
fun main() {
val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()
val params: ProductUpdateFilesParams = ProductUpdateFilesParams.builder()
.id("id")
.fileName("file_name")
.build()
val response: ProductUpdateFilesResponse = client.products().updateFiles(params)
}require "dodopayments"
dodo_payments = Dodopayments::Client.new(
bearer_token: "My Bearer Token",
environment: "test_mode" # defaults to "live_mode"
)
response = dodo_payments.products.update_files("id", file_name: "file_name")
puts(response)curl --request PUT \
--url https://test.dodopayments.com/products/{id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_name": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://test.dodopayments.com/products/{id}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'file_name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>"
}