Traverzer
  • About
  • Basics
    • Insert & Update
    • Fetch & Find
    • Delete
  • Reference
    • PUT
    • POST
    • DELETE
Powered by GitBook
On this page
  • Examples
  • Fetch Record
  • Find Records
Edit on GitHub
  1. Basics

Fetch & Find

With Traverzer, fetching a single record or finding a list of records is through the same POST endpoint. As with all the endpoints, you first specify the table name and then, in the case of fetching and finding, you specify which fields you want returned. Only the fields specified in the request will be populated.

Examples

Fetch Record

To find a single record by any one field, fill in the value for that field.

Request

fetch('https://api.traverzer.tech/', { 
    method: 'POST', 
    headers: { 
        'Content-Type': 'application/json',
        'Authorization': <token>
    }, 
    body: JSON.stringify({ 
        user: { 
            username: "johndoe", 
            email: "", 
            profile: { 
                name: "", 
                address: { 
                    state: "" 
                }, 
            } 
        } 
    }) 
});

Response

{ 
    "user": { 
        "username": "johndoe", 
        "email": "johndoe@example.com", 
        "profile": { 
            "name": "John Doe", 
            "address": { 
                "state": "CA", 
            }, 
        } 
    } 
}

Find Records

To find a list of records by any one field, wrap the fields in an array and fill in the field with a value.

Request

fetch('https://api.traverzer.tech/', { 
    method: 'POST', 
    headers: { 
        'Content-Type': 'application/json',
        'Authorization': <token>
    }, 
    body: JSON.stringify({ 
        user: [{ 
            username: "", 
            email: "", 
            profile: { 
                name: "", 
                address: { 
                    state: "CA" 
                }, 
            } 
        }]
    }) 
});

Response

{ 
    "user": [{ 
        "username": "johndoe", 
        "email": "johndoe@example.com", 
        "profile": { 
            "name": "John Doe", 
            "address": { 
                "state": "CA", 
            }, 
        } 
    },
    {
        "username": "maryjane", 
        "email": "maryjane@example.com", 
        "profile": { 
            "name": "Mary Jane", 
            "address": { 
                "state": "CA", 
            }, 
        } 
    }]
}

Last updated 3 months ago