Docker api build not tagging my images but with command it works

Hello, i made in rust an api that builds an image from a directory
this is the code:

// build image
pub fn build_image_fn(docker_api_ip: &str, image_name: &str, img_path: &str) -> Result<String, Error> {
  let client = Client::new();
  // Create a temporary in-memory buffer to store the tarball
  let mut tarball: Vec<u8> = Vec::new();
  // Create a tarball from the directory
      let mut tar_builder = Builder::new(&mut tarball);
      tar_builder.append_dir_all("", img_path).expect("failed to append the dir");
  // post
  println!("imgname: {image_name}");
  let url = format!("http://{docker_api_ip}/build?t={image_name}&rm=true");
  let response = client
    .header("Content-Type", "application/x-tar")
  // Check if the request was successful
  match response {
    Ok(response) => {
      if response.status().is_success() {
        Ok("Image builded successfully".to_string())
      } else {
          let status = response.status().clone();
          let body = response.text().unwrap();
          let err = serde_json::from_str::<ApiErr>(&body).expect("failed to deserialize build_image_fn error json");
          let err_str = format!("Error: code:{}, message: {}", status, err.message);
    Err(err) => {

the image name is 2023-06-08-11-19-31-openvas-gmp-scripts:latest
using this function the docker api responds correctly with a statuc code = 200
but when i do docker images i see a none image

REPOSITORY           TAG       IMAGE ID       CREATED          SIZE
<none>               <none>    663f9a24da85   10 minutes ago   1.3GB

instead if i do it with:

sudo docker build -t 2023-06-08-11-19-31-openvas-gmp-scripts:latest openvas_gmp_scripts/

it works correctly and the image gets tagged correctly with 2023-06-08-11-19-31-openvas-gmp-scripts:latest and it’s size is 1.5GB.

REPOSITORY                                TAG       IMAGE ID       CREATED          SIZE
2023-06-08-11-19-31-openvas-gmp-scripts   latest    6941c10384f9   55 seconds ago   1.59GB

is it possible to solve this?