Get the agent result

This API will fetch the agent result output by agent id

Query parameters

Parameter Type Description

limit

(Optional, Default : 20)

integer A number between 1 and 1000, the maximum number of results to display per page

offset

(Optional, Default : 0)

integer The number of results to skip, for showing the next page

Code

$http.get("https://api.agenty.com/2.0/results/{AgentId}?key={ApiKey}")
            .success(function (response) {
               console.log(response)
            }).error(function (response) {
               console.log(response) 
            });

Sample output

{
  "agent_id": "78142457cb",
  "job_id": 199,
  "job_status": "Completed",
  "version": 35,
  "started_at": "2018-03-08 06:02:43Z",
  "completed_at": "2018-03-08 09:33:41Z",
  "collection": 1,
  "is_modified": false,
  "total": 144,
  "offset": 0,
  "limit": 25,
  "returned": 25,
  "result": [
    {
      "ProductName": "Product A",
      "ProductPrice": "$21.40",
      "ProductImage": "http://placehold.it/400x250/000/fff",
      "ProductCartLink": "/cart/118",
      "Page": "https://cdn.agenty.com/sample_content/list/ecommerce-product-list.html"
    },
    {
      "ProductName": "Product B",
      "ProductPrice": "$16.80",
      "ProductImage": "http://placehold.it/400x250/000/fff",
      "ProductCartLink": "/cart/119",
      "Page": "https://cdn.agenty.com/sample_content/list/ecommerce-product-list.html"
    },
    {
      "ProductName": "Product C",
      "ProductPrice": "$30.00",
      "ProductImage": "http://placehold.it/400x250/000/fff",
      "ProductCartLink": "/cart/120",
      "Page": "https://cdn.agenty.com/sample_content/list/ecommerce-product-list.html"
    }
  ]
}

Example in C#

This C# example fetches the response using HTTP Get method and then parse the result JSON object using JsonConvert. Once the JSON is converted into AgentyResultModel, you can loop through each record from array as in example below.

void Main()
{
	string api = "https://api.agenty.com/2.0/results/{AgentId}?key={ApiKey}&offset=0&limit=1000";
    //using System.Net.Http namespace in .NET 4.5	
    using (var client = new HttpClient()) 
	{
		var response = client.GetStringAsync(api);	
        // Use nuget package Newtonsoft.Json for JsonConvert	 	
	 	var json = JsonConvert.DeserializeObject<AgentyResultModel>(response.Result);	
		foreach(var record in json.result)
		{
			// Do whatever you want with your result rows
			Console.WriteLine(record.Field1);
			Console.WriteLine(record.Field2);			
		}
	}	
}

public class AgentyResultModel
{
    public string agent_id { get; set; }
    public int job_id { get; set; }
    public string job_status { get; set; }
    public int version { get; set; }
    public string started_at { get; set; }
    public string completed_at { get; set; }
    public int collection { get; set; }
    public bool is_modified { get; set; }
    public int total { get; set; }
    public int offset { get; set; }
    public int limit { get; set; }
    public int returned { get; set; }
    public List<Result> result { get; set; }
}

public class Result
{
    public string Field1 { get; set; }
    public string Field2 { get; set; }
}