Subscriptions API
Create a new subscription
Section titled “Create a new subscription”POST https://api.pingstreams.com/v3/:project_id/subscriptionsThis endpoint allows to add more subscriptions.
Path Parameters
Section titled “Path Parameters”- project_id
string- The project_id is a unique code assigned to your project when you create it in Pingstreams
Headers
Section titled “Headers”- Authorization
string- authorization token. Basic Auth or JWT - Content-Type
string- use “application/json” value
Request Body
Section titled “Request Body”- event
string- the event method - target
string- the target url
Response
Section titled “Response”{
"__v": 0,
"updatedAt": "2019-03-12T12:01:56.462Z",
"createdAt": "2019-03-12T12:01:56.462Z",
"target": "https://webhook.site/c312005b-5042-49e9-a769-0f3ba4245b51",
"event": "request.create",
"id_project": "5b55e806c93dde00143163dd",
"createdBy": "5ab11c6b83dc240014d46095",
"_id": "5c879fb4f1ae6600173b8c75",
"secret": "56c189c8-33ae-4930-bd98-410a12aa45ce"
}Example
Section titled “Example”curl -v -X POST -H 'Content-Type:application/json' \
-u user@example.com:123456 \
-d '{"event":"request.create", "target":"https://webhook.site/c312005b-5042-49e9-a769-0f3ba4245b51"}' \
https://api.pingstreams.com/v3/5b55e806c93dde00143163dd/subscriptionsGet all subscriptions
Section titled “Get all subscriptions”GET https://api.pingstreams.com/v3/:project_id/subscriptionsThis endpoint retrieves all active subscriptions.
Path Parameters
Section titled “Path Parameters”- project_id
string- the Project Id is a unique code assigned to your project when you create it in Pingstreams.
Headers
Section titled “Headers”- Authorization
string- authorization token. Basic Auth or JWT
Response
Section titled “Response”[
{
"__v": 0,
"updatedAt": "2019-03-12T12:01:56.462Z",
"createdAt": "2019-03-12T12:01:56.462Z",
"target": "https://webhook.site/c312005b-5042-49e9-a769-0f3ba4245b51",
"event": "request.create",
"id_project": "5b55e806c93dde00143163dd",
"createdBy": "5ab11c6b83dc240014d46095",
"_id": "5c879fb4f1ae6600173b8c75"
}
]Get a subscription by id
Section titled “Get a subscription by id”GET https://api.pingstreams.com/v3/:project_id/subscriptions/:idThis endpoint retrieves a subscription by ID
Path Parameters
Section titled “Path Parameters”- id
string- the subscription identifier - project_id
string- The project_id is a unique code assigned to your project when you create it in Pingstreams
Headers
Section titled “Headers”- Authorization
string- authorization token. Basic Auth or JWT
Response
Section titled “Response”{
"__v": 0,
"updatedAt": "2019-03-12T12:01:56.462Z",
"createdAt": "2019-03-12T12:01:56.462Z",
"target": "https://webhook.site/c312005b-5042-49e9-a769-0f3ba4245b51",
"event": "request.create",
"id_project": "5b55e806c93dde00143163dd",
"createdBy": "5ab11c6b83dc240014d46095",
"_id": "5c879fb4f1ae6600173b8c75"
}Delete a subscription
Section titled “Delete a subscription”DELETE https://api.pingstreams.com/v3/:project_id/subscriptions/:idThis endpoint delete a subscription by ID
Path Parameters
Section titled “Path Parameters”- id
string- the subscription identifier - project_id
string- The project_id is a unique code assigned to your project when you create it in Pingstreams
Headers
Section titled “Headers”- Authorization
string- authorization token. Basic Auth or JWT
Response
Section titled “Response”{
"_id": "5c81593adf767b0017d1aa66",
"updatedAt": "2019-03-07T17:47:38.393Z",
"createdAt": "2019-03-07T17:47:38.393Z",
"lead_id": "SRbb2PfbSFcgICv9VQBcURZeloh1",
"fullname": "Guest",
"attributes": { },
"id_project": "5b55e806c93dde00143163dd",
"createdBy": "system",
"__v": 0
}Update a subscription
Section titled “Update a subscription”PUT https://api.pingstreams.com/v3/:project_id/subscriptions/:idThis endpoint updates a subscription.
Path Parameters
Section titled “Path Parameters”- project_id
string- The project_id is a unique code assigned to your project when you create it in Pingstreams - id
string- the subscription identifier
Headers
Section titled “Headers”- Authorization
string- authorization token. Basic Auth or JWT - Content-Type
string- use “application/json” value
Request Body
Section titled “Request Body”- event
string- the event method - target
string- the target url
Response
Section titled “Response”{
"__v": 0,
"updatedAt": "2019-03-12T12:01:56.462Z",
"createdAt": "2019-03-12T12:01:56.462Z",
"target": "https://webhook.site/c312005b-5042-49e9-a769-0f3ba4245b51",
"event": "request.create",
"id_project": "5b55e806c93dde00143163dd",
"createdBy": "5ab11c6b83dc240014d46095",
"_id": "5c879fb4f1ae6600173b8c75"
}Example
Section titled “Example”curl -v -X PUT -H 'Content-Type:application/json' \
-u user@example.com:123456 \
-d '{"event":"request.create", "target":"https://webhook.site/c312005b-5042-49e9-a769-0f3ba4245b51"}' \
https://api.pingstreams.com/v3/5b55e806c93dde00143163dd/subscriptions/5c879fb4f1ae6600173b8c75Get the subscriptions logs
Section titled “Get the subscriptions logs”GET https://api.pingstreams.com/v3/:project_id/subscriptions/historyThe endpoint receives subscription call logs.
Path Parameters
Section titled “Path Parameters”- project_id
string- the Project Id is a unique code assigned to your project when you create it in Pingstreams.
Query Parameters
Section titled “Query Parameters”- page
number- what page of results to fetch. default to first page.
Headers
Section titled “Headers”- Authorization
string- authorization token. Basic Auth or JWT
Response
Section titled “Response”[
{
"_id": "5e3ae8309ae7ee0017d91609",
"event": "message.create",
"target": "https://pingstreams.requestcatcher.com/test",
"response": "{\"statusCode\":200,\"body\":\"request caught\",\"headers\":{\"date\":\"Wed, 05 Feb 2020 16:07:11 GMT\",\"content-length\":\"14\",\"content-type\":\"text/plain; charset=utf-8\",\"connection\":\"close\"},\"request\":{\"uri\":{\"protocol\":\"https:\",\"slashes\":true,\"auth\":null,\"host\":\"pingstreams.requestcatcher.com\",\"port\":443,\"hostname\":\"pingstreams.requestcatcher.com\",\"hash\":null,\"search\":null,\"query\":null,\"pathname\":\"/test\",\"path\":\"/test\",\"href\":\"https://pingstreams.requestcatcher.com/test\"},\"method\":\"POST\",\"headers\":{\"Content-Type\":\"application/json\",\"x-hook-secret\":\"0060287d-9486-4f00-a4db-a254f998dbd1\",\"accept\":\"application/json\",\"content-length\":6005}}}",
"body": "\"request caught\"",
"err": null,
"id_project": "5e37f45c4d82de00178b96ad",
"createdAt": "2020-02-05T16:07:12.089Z",
"updatedAt": "2020-02-05T16:07:12.089Z",
"__v": 0
}
]Example
Section titled “Example”curl -v -X GET -u user@example.com:123 \
https://api.pingstreams.com/v3/5e37f45c4d82de00178b96ad/subscriptions/history