GWN - HTTP API Signature Computation Issue - PHP Curl



I am getting an Authentication Failure message with code retCode:50003 when trying to consume the GWN APIs.

I am successfully getting the access token, however, when trying to compute the signature - the exact way as the doc here - and call any API I got the above error message.

Here how I computed the signature and call the API.

         $timestamp = round(microtime(true) * 1000);

            $public_params = array('access_token' => $this->token,
                'appID' => $this->client_id,
                'secretKey' => $this->client_secret,
                'timestamp' => $timestamp);

            $public_params['signature'] = hash('sha256', '&' . http_build_query($public_params) . '&');

            $ch = curl_init();
            $options = array(
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_SSL_VERIFYPEER => false,
                CURLOPT_SSL_VERIFYHOST => false,
                CURLOPT_URL => $this->base_url_api . '/network/list?' . http_build_query($public_params),
                CURLOPT_HTTPHEADER => array(
                    "Content-type: application/json"
            curl_setopt_array($ch, $options);
            $response = curl_exec($ch);


Hi omer,

I am working through the Signature Computation also - did you have any update or find a solution to the Issue you experienced here?

I am being thrown a 401 error code.



The docs state to generate the signature using the body and only do so if the request has a body.


Hi Jboden555,

Yes, it got to work by adding a payload to the request as below.

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));

Remember the payload body should include the secret key parameter and you should remove it from the request parameters,

Hope this helps.


thank you-

What if there is no body to add in the request?


I missed this before, but the signature for a request with a body:

signature=sha256 (&params&sha256(body)&)

Signature of a request without a body:

signature=sha256 (&params&)


Great, working now I added the body request. Thanks all.


I have been able to call network/list and network/detail but receiving Authentication Failure when calling network/create. Payload is as follows;

$body_data = array(
            'networkName'           => "A_55_B",
            'country'               => "US",
            'timezone'              => "America/New_York",
            'networkAdministrators' => [
            'cloneNetworkId'        => 12345

Not sure if it is because of the type for networkAdministrators or cloneNetworkId but the edits I tried for that still returned the error.


I found an answer that worked - I added JSON_UNESCAPED_SLASHES when encoding the data.

$body = json_encode($body_data, JSON_UNESCAPED_SLASHES);

Also unquoted the networkAdministrators array values and the call was successful.


any chance you could post your updated complete code? ta.


Hello Mr. Boden!

Can you please share the piece of code to query clients list? I cant perform any POST… Just GET.

Do I have to put the body params in the signature first calculation? It’s kinda confusing to me. I’m using Python. But I can read PHP.

Here’s what my code looks like:

def networkDetail():

    endpoint = base_url + "/oapi/v1.0.0/network/detail?"

    params = {
        "access_token": get_api_key(),
        "appID": client_id,
        "secretKey": client_secret,
        "timestamp": int(time.time())*1000

    encoded_params = urllib.parse.urlencode(params)

    json_body = {"id":63312}

    json_string = json.dumps(json_body)

    json_sha256 = sha256(json_string)

    params["signature"] = sha256(f"&{encoded_params}&{json_sha256}&")


    headers = {"Content-type": "application/json"}

    url = endpoint + urllib.parse.urlencode(params)

    response =, headers=headers, data=json_body)

    if response.status_code == 200:
        print("Response:", response.json())
        print("Request failed with status code:", response.status_code)