Hosfad Posted July 13, 2022 Posted July 13, 2022 Hello im trying to make an auto message pumping system and i need to make a post request to the api to add the topic , currently im trying : axios.post("https://www.DOMAIN.com/api/index.php/forums/topics",{ params: { key: 'MYAPIKEY', forum: '79', title: 'pumping test', post: 'pumping test', author: '1', }}).then((res)=>{}).catch((err) =>{ console.log(err) }) And im getting a NO_API_KEY response : data: { errorCode: '2S290/6', errorMessage: 'NO_API_KEY' } Anyone has an idea how i should be adding the params ?
Stuart Silvester Posted July 13, 2022 Posted July 13, 2022 Try using basic auth instead as noted here: https://invisioncommunity.com/developers/rest-api You can only pass a key as a parameter in certain circumstances where the server doesn't support basic authentication. SeNioR- 1
Hosfad Posted July 13, 2022 Author Posted July 13, 2022 (edited) 49 minutes ago, Stuart Silvester said: Try using basic auth instead as noted here: https://invisioncommunity.com/developers/rest-api You can only pass a key as a parameter in certain circumstances where the server doesn't support basic authentication. Hello , im having no trouble making the same request with insomnia using the api key as the authentication , its only when i try to make the post request with axios , i have also no trouble making get requests with axios This is also on my private api , so i dont need to worry about exposing the api key's Edited July 13, 2022 by Hosfad
Solution Hosfad Posted July 13, 2022 Author Solution Posted July 13, 2022 (edited) Turns out adding a null param as the second param to the .post request does it 😮 Edited July 13, 2022 by Hosfad SeNioR- 1
Recommended Posts