VaRest
VaRest copied to clipboard
How to insert API key to Set Header? Any Blueprint example?
How to insert API key to Set Header?
Any example on Blueprint?
How to use Set Header from Varest plugin?
I don’t know how to insert x-api-key to Varest?
Any Blueprint example?
same question, need some help
Same problem. How to Set Header correctly (Bearer "token" ) after login get token string?
1st of all - I saw many of you rely on the "Call URL" - in most cases it's useless (not always)
Workflow: Mostly you want to add headers and everything, then you bind the Custom Event to On Request Complete (it holds also errors coming back as response so it's enough) then finally - Processs URL
Headers:
- You Construct Json Request, save as Variable
- You get the Request Object from it and save as Variable
The Request Object is where you set your Headers using Set Header and/or Parameters using "Set String Field" The Json Request is where you Bind the Event and Process URL
Once you get the Response (Custom Event) right afterward Get Response Content as String to see what we got back from Server, then we Get Response Object from the Response and save to Variable fo easier usage
You get the Data from the Json Object by using "Get String Field", "Get Int Field" etc. d_epending on the data the field holds_
Example:
I Hold the crucial info in my PController and pass to a Custom Function
If you read the steps above starting from "Headers" and follow the images you'll find your way
Most of the Requests start this way:
Then you set your Headers and/or Paramaters
In this case those are Parameters as I used "Set X Field" (X = String, Int etc.)
Bind the Event
And finally Process URL (The bool is just for PrintString to determine if it should be visible on Screen)
The Response from Server:
Like said you get the Response and make a Print String to know what is happening and what data you get back
At the end you can use that Data you've got back, as this is the 1st Guest Login I wanted to save my Session Token that we need for any further API
Example after successful Login: From this point you need the Session Token Header to proceed with any API
The only thing that happens is that the Response itself is being saved into a kind of Log
Get Player Info Function:
Va Rest Construct Request Function (this is where we construct the Request and pass Headers
Again same thing - we construct a Request and save Variables to use them more convenient
Afterwards (finally!)** we pass Headers we need**, we can pass Parameters too - simply use "Set X Field"
Custom Verb is needed if we want to use Requests like PATCH that's not a part of the Enum by the Request Construct
Using the Data we got from Server
After we got the Response Object - this is what holds the information, as this was getting the Player Name I tested what is the Response, learned what Field holds the data of my interest (name) and used "Get String Field" to get that value
A bit of practice, doing mistakes and so on and you're gonna get it