Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating docs to include content-type header #20

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/rest-api/Authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ const createEvent = async () => {
values: ["eggs", "bacon", "pasta", "bread"],
}),
},
{ headers: { "x-api-key": "YOUR_API_KEY" } }
{
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
}
Comment on lines +30 to +35
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not set by default when you send a json body?

image

image

I looked at the discord thread and I guess it depends on the HTTP client you are using, hence my preference for axios here. Perhaps a comment / section under headers in the REST api section - thoughts?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea it totally depends on the client and it won't hurt by adding it on but it will totally fail if the client doesn't include it.

We can add a section for headers, but it seems slightly overkill vs just a line in the example. Im good with either though.

);

console.log("Event created 🎉", data);
Expand Down
7 changes: 6 additions & 1 deletion docs/rest-api/Cron Jobs ⚠️/create-a-cron-job.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ const createCronJob = async () => {
values: ["eggs", "bacon", "pasta", "bread"],
}),
},
{ headers: { "x-api-key": "YOUR_API_KEY" } }
{
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
}
);

console.log("Cron Job created 🎉", data);
Expand Down
5 changes: 4 additions & 1 deletion docs/rest-api/Cron Jobs ⚠️/get-cron-job-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ const apiBaseUrl = "https://app.jiter.dev/api";
const getCronJob = async () => {
try {
const { data } = await axios.get(`${apiBaseUrl}/cronjobs/9`, {
headers: { "x-api-key": "YOUR_API_KEY" },
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
});

console.log("Cron job found 🎉", data);
Expand Down
5 changes: 4 additions & 1 deletion docs/rest-api/Cron Jobs ⚠️/get-many-cron-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ const apiBaseUrl = "https://app.jiter.dev/api";
const getManyCronJobs = async () => {
try {
const { data } = await axios.get(`${apiBaseUrl}/cronJobs`, {
headers: { "x-api-key": "YOUR_API_KEY" },
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
});

console.log("Cron jobs found 🎉", data);
Expand Down
7 changes: 6 additions & 1 deletion docs/rest-api/Cron Jobs ⚠️/update-cron-job.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ const updateCronJob = async () => {
{
status: "Disabled",
},
{ headers: { "x-api-key": "YOUR_API_KEY" } }
{
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
}
);

console.log("cron job updated 🎉", data);
Expand Down
7 changes: 6 additions & 1 deletion docs/rest-api/Events/create-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ const createEvent = async () => {
values: ["eggs", "bacon", "pasta", "bread"],
}),
},
{ headers: { "x-api-key": "YOUR_API_KEY" } }
{
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
}
);

console.log("Event created 🎉", data);
Expand Down
5 changes: 4 additions & 1 deletion docs/rest-api/Events/get-event-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ const apiBaseUrl = "https://app.jiter.dev/api";
const getEvent = async () => {
try {
const { data } = await axios.get(`${apiBaseUrl}/events/47`, {
headers: { "x-api-key": "YOUR_API_KEY" },
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
});

console.log("Event found 🎉", data);
Expand Down
5 changes: 4 additions & 1 deletion docs/rest-api/Events/get-many-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ const getManyEvents = async () => {

try {
const { data } = await axios.get(`${apiBaseUrl}/events?${query}`, {
headers: { "x-api-key": "YOUR_API_KEY" },
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
});

console.log("Events found 🎉", data);
Expand Down
7 changes: 6 additions & 1 deletion docs/rest-api/Events/update-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ const updateEvent = async () => {
}),
status: "Cancelled",
},
{ headers: { "x-api-key": "YOUR_API_KEY" } }
{
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
}
);

console.log("Event updated 🎉", data);
Expand Down