Get your token

    To use the Viewtravel suite API you need to authenticate. For that you must use http or https AUTH and generate the token in BASE64 of the credentials. The way to implement this functionality varies for each programming language

If you are in a test environment, use https://tests.view-travel.com/. For a production environment use https://view-travel.com/




  • This is a sample request by curl:
curl -d '{"username":"username","password":"password"}'
-H "Content-Type:application/json" 
-X POST https://tests.view-travel.com/api/get-token-auth/
  • If successful, this call will return a neatly packaged Token that you can user to make authenticated calls to API

{
  'token': '23c618d5becf741d264c8d92a61adfce9db6f43f'
}

  • This is an example using javascript fetch
let params = {
  'username': 'username',
  'password': 'password'
}

fetch('https://tests.view-travel.com/api/get-token-auth/', {
    method: 'post',
    credentials: 'same-origin',
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json'
    },
    body: JSON.stringify(params)
})
.then(res => res.json())
.catch(error => console.error('Error:', error))
.then(response => console.log('Success:', response));

https://codepen.io/lenines/pen/xxGKzxP?editors=0012