#sdk #open #platform #iop #tokio #request-parameters #ali-express

bin+lib iop-sdk-rust

Unofficial Rust AliExpress Open platform SDK (iop-sdk-rust-20231210)

4 releases

0.0.4 Mar 12, 2024
0.0.3 Dec 11, 2023
0.0.2 Dec 10, 2023
0.0.1 Dec 10, 2023

#1 in #iop

Download history 41/week @ 2024-02-23 19/week @ 2024-03-01 119/week @ 2024-03-08 17/week @ 2024-03-15 1/week @ 2024-03-22 17/week @ 2024-03-29 23/week @ 2024-04-05

67 downloads per month

MIT license

35KB
628 lines

iop-sdk-rust

Unofficial Rust AliExpress Open platform SDK (iop-sdk-rust)

Example:

use std::collections::HashMap;
use dotenv_vault::dotenv;
use iop::{Iop, ApiName, RequestParameters, Result};


#[tokio::main]
async fn main() -> Result<()> {

    dotenv().expect(".env file not found");

    let app_key = std::env::var("APPKEY").expect("APPKEY variable dosn't exist");
    let secret = std::env::var("SECRET").expect("SECRET variable dosn't exist");

    let top_api = Iop::new(app_key.as_str(), secret.as_str());

    let url = "https://www.aliexpress.com/w/wholesale-삼성노트북.html"; // Aliexpress product url

    let mut request_parameters: RequestParameters = HashMap::new();
    request_parameters.insert("app_signature".to_string(), "asdasdasdsa".to_string());
    request_parameters.insert("promotion_link_type".to_string(), "0".to_string());
    request_parameters.insert("source_values".to_string(), url.to_string());
    request_parameters.insert("tracking_id".to_string(), "yourtracking_id".to_string());
    
    let response = top_api.request(ApiName::GenerateAffiliateLinks, Some(request_parameters)).await?;

    if response.status().is_success(){
        println!("is_success"); 
        println!("{:#?}", response.text().await?);  
    }

    Ok(())
}

TODO:

  • add more Apis
  • Add more http methods
  • Add sha256 sign method

Dependencies

~7–21MB
~306K SLoC