diff --git a/api-reference/subscribers/get-subscribers.mdx b/api-reference/subscribers/get-subscribers.mdx index a7d71990..1279020c 100644 --- a/api-reference/subscribers/get-subscribers.mdx +++ b/api-reference/subscribers/get-subscribers.mdx @@ -1,5 +1,155 @@ --- -openapi: get /v1/subscribers +openapi: get /v1/subscribers/{subscriberId} --- - \ No newline at end of file + + + + +```javascript Node.js +import { Novu } from '@novu/node'; + +const novu = new Novu(""); + +const response = await novu.subscribers.get("subscriberId"); +console.log(response.data); +``` + +```bash cURL +curl --request GET \ + --url https://api.novu.co/v1/subscribers \ + --header 'Authorization: ' +``` + +```python Python +import requests + +url = "https://api.novu.co/v1/subscribers" + +headers = {"Authorization": ""} + +response = requests.request("GET", url, headers=headers) + +print(response.text) +``` + +```js JavaScript +const options = {method: 'GET', headers: {Authorization: ''}}; + +fetch('https://api.novu.co/v1/subscribers', options) + .then(response => response.json()) + .then(response => console.log(response)) + .catch(err => console.error(err)); +``` + +```php PHP + "https://api.novu.co/v1/subscribers", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "GET", + CURLOPT_HTTPHEADER => [ + "Authorization: " + ], +]); + +$response = curl_exec($curl); +$err = curl_error($curl); + +curl_close($curl); + +if ($err) { + echo "cURL Error #:" . $err; +} else { + echo $response; +} +``` + +```go Go +package main + +import ( + "fmt" + "net/http" + "io/ioutil" +) + +func main() { + + url := "https://api.novu.co/v1/subscribers" + + req, _ := http.NewRequest("GET", url, nil) + + req.Header.Add("Authorization", "") + + res, _ := http.DefaultClient.Do(req) + + defer res.Body.Close() + body, _ := ioutil.ReadAll(res.Body) + + fmt.Println(res) + fmt.Println(string(body)) + +} +``` + +```java Java +HttpResponse response = Unirest.get("https://api.novu.co/v1/subscribers") + .header("Authorization", "") + .asString(); +``` + + + + + +```json Response +{ + "data": [ + { + "__v": "number", + "_environmentId": "string", + "_id": "string", + "_organizationId": "string", + "avatar": "string", + "channels": [ + { + "_integrationId": "string", + "credentials": { + "channel": "string", + "deviceTokens": [ + "string" + ], + "webhookUrl": "string" + }, + "integrationIdentifier": "string", + "providerId": "slack" + } + ], + "createdAt": "string", + "deleted": "boolean", + "email": "string", + "firstName": "string", + "isOnline": "boolean", + "lastName": "string", + "lastOnlineAt": "string", + "locale": "string", + "phone": "string", + "subscriberId": "string", + "updatedAt": "string" + } + ], + "hasMore": "boolean", + "page": "number", + "pageSize": "number" +} +``` + +