WebAPI integration

Technical questions relating to the iVeri WebService integration

WebAPI integration

by Stephen Fri Mar 25, 2016 11:07 pm
I'm trying to interact with the WebAPI layer through my PHP application running using the GuzzleHttp client, but I'm finding myself very confused as the WebAPI documentation isn't very clear. I've a couple of questions.

1) The docs show examples of Java and C# generating the base64 encoded SHA256 string, but the code expects the password and URL string to be defined - What URL is this supposed to be? The API endpoint or the full domain URL including the protocol?

I've rewritten the Java/C# code into PHP as follows:

Code: Select all
    private function generateToken($password, $date, $url) {           
        $md5_password = md5($password, true);
        $token_bytes = $this->gateway . $url.$date.$md5_password;
        $token_hash = hash("sha256", $token_bytes, true);
        return base64_encode($token_hash);

The above returns an exact match as the Java and C# code depending on what values have been passed to 'password', 'date' and 'url'.

So once the above question is answered, the above code should do fine.

2) The next unclear bit of information is the authorisation header. The documentation specifies basic auth as the HTTP authentication method, but requests for usergroup, username, timestamp and token to be sent using basic auth? Correct me if I'm wrong, but basic auth generally expects only a username and password which GuzzleHttp actually enforces - an error is thrown if an attempt to throw in additional params is executed.

If somebody with some PHP experience with this authentication process could assist, that'd be great or if someone could elaborate on the documentation a little as it's not very detailed.
Tue Mar 22, 2016 4:03 pm

Jump To