Update License Key Instance

Update a specific license key instance by its ID.

Request

use dodopayments_rust::{
    models::PatchLicenseKeyInstanceRequest, to_pretty_json, DodoPaymentsClientBuilder,
};

#[tokio::main]

async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api_key = std::env::var("DODO_API_KEY")?;

    let client = DodoPaymentsClientBuilder::new()
        .bearer_token(&api_key)
        .enviroment("test_mode")
        .build()?;

    let license_key_id = "lic_xxxxxxxxxx";
    let instance_id = "lki_xxxxxxxxxx";

    let resp = client
        .licenses()
        .license_keys()
        .id(license_key_id)
        .license_key_instances()
        .id(instance_id)
        .update()
        .body(PatchLicenseKeyInstanceRequest {
            name: "Updated Device Name".to_string(),
            ..Default::default()
        })
        .send()
        .await?;

    println!("{}", to_pretty_json(&resp)?);

    Ok(())
}

Path Parameters

ParameterTypeDescription
idstringLicense key instance ID

Body

FieldTypeDescription
namestring

Responses

200 Status

FieldTypeDescription
business_idstring
created_atstring
idstring
license_key_idstring
namestring

License key instance updated

404 Status

License key instance not found

500 Status

Something went wrong :(