Any POST request I try to do either in my code or postman I get Status: 403 Error: "Invalid Key" I am using that same key in GET requests to pull back order data though.
Here's how I'm structuring the request:
https://api.brickowl.com/v1/order/set_status?key=<key>&order_id=<order number>&status_id=3
I'm not sure what I'm doing wrong.
Comments
Can you update the top part of the API docs with the expected payload? Right now it says all requests should look like my first example with query parameters.
request({
method: "POST",
uri: "https://api.brickowl.com/v1/order/set_status",
body: {
key: process.env.brickowl,
order_id: orderid,
status_id: 3
},
json: true
})
// Send the POST request
fetch('https://api.brickowl.com/v1/order/set_status', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': "APIKEY" //has to be replaced
},
body: JSON.stringify({
order_id: 9229622,
status_id: 4
})
})
.then(res => {
return res.json()
})
.then(data => console.log('data:', data))
.catch(error => console.error('Error:', error))
// Replace with your actual BrickOwl API endpoint
const brickOwlApiUrl = 'https://api.brickowl.com/v1/order/set_status';
// Replace with the data you want to send in the request body
const postData = {
order_id: '9229622', // Replace with the order ID you want to update
new_status: '3' // Replace with the desired status
// Add any other data you need to send
};
// Set your authentication headers, e.g., using a Bearer token
const headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer APIKEY', //has to be changed
};
// Make the POST request
axios.post(brickOwlApiUrl, postData, { headers })
.then((response) => {
console.log('Response:', response.data);
// Handle the response data here
})
.catch((error) => {
console.error('Error:', error);
// Handle the error here
});
const url = 'https://api.brickowl.com/v1/order/set_status';
const body = {
key: 'APIKEY',
order_id: 4109948,
status_id: 2
};
request.post({
url: url,
form: body,
}, (error, response, body) => {
if (error) {
console.error('There was an error:', error);
} else if (response.statusCode !== 200) {
console.error('Status code:', response.statusCode);
} else {
console.log('Data received:', body);
}
});