apify

why am I getting "actor not found" when calling the last succesful run from an actor in Apify?


I'm getting this error when calling last succesful run from an Apify actor. Does anybody know why? I couldn't find the actor id anywhere so I used the name of the actor instead.

enter image description here

this is my api call to get last succesful fun from my actor.....................................

func getZillowListings() -> Bool {
        
        //@Binding var listingsResults : Bool
        let token = "SECRET"
        let taskId = "ZE5LuEYvZzcWW0nGA"
        let actorId = "zillow-api-scraper"
        var urlComponents = URLComponents(string: "https://api.apify.com/v2/acts/\(actorId)/runs/last")
        
        urlComponents?.queryItems = [
            URLQueryItem(name: "actorTaskId", value: taskId),
            URLQueryItem(name: "token", value: token),
            URLQueryItem(name: "status", value: "SUCCEEDED"),
        ]
        let url = urlComponents?.url
        
        if let url = url {
            
            // Create URL Request
            var request = URLRequest(url: url, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: 10.0)
            request.httpMethod = "GET"
            //request.addValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
            
            // Get URLSession
            let session = URLSession.shared
            
            // Create Data Task
            let dataTask = session.dataTask(with: request) { (data, response, error) in
                
                // Check that there isn't an error
                if error == nil {
                    
                    do {
                        
                        if data != nil {
                            
                            let json = try JSONSerialization.jsonObject(with: data!, options:[])
                            print("Received response")
                            print(json)
                            
                            
                            // decode the json to an array of listings
                            self.listingsZ = try! JSONDecoder().decode([ListingsZillow].self, from: data!)
                            
                      self.results!.listings.removeAll() {
                            
                            //                            }
                            
                            self.getShortPriceZillow()
                            
                        }
                        
                        
                    }
                    catch {
                        print(error)
                        
                    }
                }
            }
            
            // Start the Data Task
            dataTask.resume()
            return true
        } else {
            return false
        }
        
    }

Solution

  • For name, you have to use username~actorname so petr_cermak~zillow-api-scraper. The ID is x5YtEpoHnmvaaEgoD