-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d47022f
commit 1f70dff
Showing
1 changed file
with
152 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,155 @@ | ||
--- | ||
openapi: get /v1/subscribers | ||
openapi: get /v1/subscribers/{subscriberId} | ||
--- | ||
|
||
<Snippet file="apikey-warning.mdx" /> | ||
<Snippet file="apikey-warning.mdx" /> | ||
|
||
<RequestExample> | ||
|
||
```javascript Node.js | ||
import { Novu } from '@novu/node'; | ||
|
||
const novu = new Novu("<NOVU_API_KEY>"); | ||
|
||
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: <authorization>' | ||
``` | ||
|
||
```python Python | ||
import requests | ||
|
||
url = "https://api.novu.co/v1/subscribers" | ||
|
||
headers = {"Authorization": "<authorization>"} | ||
|
||
response = requests.request("GET", url, headers=headers) | ||
|
||
print(response.text) | ||
``` | ||
|
||
```js JavaScript | ||
const options = {method: 'GET', headers: {Authorization: '<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 | ||
<?php | ||
|
||
$curl = curl_init(); | ||
|
||
curl_setopt_array($curl, [ | ||
CURLOPT_URL => "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: <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", "<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<String> response = Unirest.get("https://api.novu.co/v1/subscribers") | ||
.header("Authorization", "<authorization>") | ||
.asString(); | ||
``` | ||
|
||
</RequestExample> | ||
|
||
<ResponseExample> | ||
|
||
```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" | ||
} | ||
``` | ||
|
||
</ResponseExample> |