Jump to content

Post request with axios


Go to solution Solved by Hosfad,

Recommended Posts

Posted

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 ?

Posted (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 by Hosfad
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...