-
Hey folks. I'm attempting to use the officially documented socketlabs api spec to download a suppression list to a csv file. I'm following this spec and running this code, (replace the API key and server id) #!/usr/bin/env node
/* eslint-disable global-require, no-console */
import fs from 'fs';
import { Headers } from 'node-fetch';
const api_key = '<token>";
const server_id = '<serverId>';
const myHeaders = new Headers();
myHeaders.append('Authorization', `Bearer ${api_key}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow',
};
fetch(`https://api.socketlabs.com/v2/server/${server_id}/suppressions/download?sortField=suppressionLastUpdate&sortDirection=dsc`, requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('error', error)); I execute this way node ./bin/socket-labs.mjs using node18 I get this response {"error":[{"errorType":"NotFound","message":"The resource you were requesting could not be found."}]} I've tried replacing the URL for the json endpoint of the same resource. To be prceise this endpoint:
And it returned a valid json response. I tried changing the url to an invalid one: https://api.socketlabs.com/v2/server/${server_id}/banana/download?sortField=suppressionLastUpdate&sortDirection=dsc and get the exact same 404 So I feel like there is a routing bug on socketlabs side... is this possible? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I have tried executing via curl and python, same result. |
Beta Was this translation helpful? Give feedback.
-
I found the issue... There are typos in your documentation https://docs.socketlabs.com/ Look carefully: server/${server_id}/b "server" should actually be "servers" Can you update this? |
Beta Was this translation helpful? Give feedback.
I found the issue... There are typos in your documentation https://docs.socketlabs.com/
Look carefully:
"server" should actually be "servers"
Can you update this?