# Get subscription events GET https://api.prolific.com/api/v1/hooks/subscriptions/{subscription_id}/events/ Get all of the events that have triggered for the given subscription. Reference: https://beta-docs.prolific.com/api-reference/webhooks/get-events ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get subscription events version: endpoint_webhooks.GetEvents paths: /api/v1/hooks/subscriptions/{subscription_id}/events/: get: operationId: get-events summary: Get subscription events description: Get all of the events that have triggered for the given subscription. tags: - - subpackage_webhooks parameters: - name: subscription_id in: path description: Subscription id required: true schema: type: string - name: offset in: query required: false schema: type: integer default: 0 - name: limit in: query required: false schema: type: integer default: 100 - name: status in: query description: >- Filter events by status. Accepts a single status or a JSON array of statuses as a string. required: false schema: type: string - name: resource_id in: query description: >- Filter events by the ID of the resource for which the event was sent. required: false schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: Retrieved content: application/json: schema: $ref: '#/components/schemas/SubscriptionEventList' '400': description: Error content: {} components: schemas: SubscriptionEventStatus: type: string enum: - value: PENDING - value: SUCCEEDED - value: FAILED SubscriptionEventPayload: type: object properties: {} SubscriptionEvent: type: object properties: id: type: string description: The ID of the subscription event. datetime_created: type: string description: The time the event was created. datetime_updated: type: string description: The last time the event was updated. event_type: type: string description: The event type that was triggered. resource_id: type: string description: The Prolific Resource ID that the event is linked to. status: $ref: '#/components/schemas/SubscriptionEventStatus' description: >- The status of the event. Will be `FAILED` if the `target_url` response is not 2xx. target_url: type: string description: The URL where the event payload is sent. payload: oneOf: - $ref: '#/components/schemas/SubscriptionEventPayload' - type: 'null' description: The event payload that was sent to the target url. SubscriptionEventList: type: object properties: results: type: array items: $ref: '#/components/schemas/SubscriptionEvent' description: All the events triggered for the subscription required: - results ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/events/" querystring = {"status":"SUCCEEDED"} headers = {"Authorization": ""} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/events/?status=SUCCEEDED'; const options = {method: 'GET', headers: {Authorization: ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/events/?status=SUCCEEDED" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/events/?status=SUCCEEDED") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '' response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.get("https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/events/?status=SUCCEEDED") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/events/?status=SUCCEEDED', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/events/?status=SUCCEEDED"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/events/?status=SUCCEEDED")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```