Accessing API through Postman

420 views
Skip to first unread message

Robert Curlette

unread,
Oct 18, 2019, 4:16:52 AM10/18/19
to ResourceSpace
I would like to access the ResourceApi through Postman with a RESTful request.  However, I have an 'invalid signature' response when querying the API.

I'm passing in 3 params:
* user: admin

* sign: 256 HSA hash using the site: https://xorbin.com/tools/sha256-hash-calculator
user=admin&do_search%26param1=+%21collection40%26param2=%26param3=%26param4=%26param5=%26param6=

* function: do_search%26param1=+%21collection40%26param2=%26param3=%26param4=%26param5=%26param6=

I'm trying to follow this example: 

and the API Test page gives me a result

Query: function=do_search&param1=+%21collection40&param2=&param3=&param4=&param5=&param6=

What am I doing wrong?

Thanks,
Robert





Pedro L

unread,
Nov 20, 2019, 12:20:30 PM11/20/19
to ResourceSpace

Hi Robert,

From what I see in the generation part of the HASH, you lack the value of the $private_key.

Looking like this
PRIVATE_KEYuser=USERAPI&function=do_search&param1=&param2=&param3=&param4=&param5=&param6=

And the rest works well in PostMan.




Regards.

Muhammad Sarwar Rana

unread,
Jan 31, 2020, 11:11:12 AM1/31/20
to ResourceSpace
Hi Pedro,

I have the similar issue but I am getting below message in PostMan.

Could not get any response
There was an error connecting to .
Why this might have happened:
  • The server couldn't send a response:
    Ensure that the backend is working properly
  • Self-signed SSL certificates are being blocked:
    Fix this by turning off 'SSL certificate verification' in Settings > General
  • Proxy configured incorrectly
    Ensure that proxy is configured correctly in Settings > Proxy
  • Request timeout:
    Change request timeout in Settings > General
This is the first time I am connecting to API and have been give admin permission , not too sure if it needs some additional permissions to call API? I am genrating the HASH as suggested in documenation.
Also my user name is 'Sarwar Rana'  and has space in the name, would that matter? shouldn't do but I thought just put it out there. 

Any help will be much appreciated.

Thanks

Muhammad Sarwar Rana

unread,
Feb 3, 2020, 6:29:23 AM2/3/20
to ResourceSpace
Bit of update.

I have switched off SSL Verification Off and updated my user name but its throwing error 'Invalid Signature'.

Please see attached image on original message.

Thanks
APICall.png

Pedro L

unread,
Feb 3, 2020, 12:54:46 PM2/3/20
to ResourceSpace
Hi Muhammad,
The only thing I can think of is that the hash you generate for API is wrong.
I've checked the steps and  postMan works.

Remember that the meaning has to be the SUM
from
User's Private API Key(black) and the query(blue) that is made (No spaces between the two parts).
And its structure is :

Example :

In this direction youcan generate the SHA-256

NUMBER_PRIVATEKEY_SarwarRanauser=SarwarRana&function=do_search&param1=bollard

Jazz Avenue Productions Kabale

unread,
Jul 5, 2021, 11:25:23 AM7/5/21
to ResourceSpace
if this worked for you guys, wud you mind sharing the postman workspace link

Jazz Avenue Productions Kabale

unread,
Jul 5, 2021, 11:25:23 AM7/5/21
to ResourceSpace
can you please specify on the hash key generationg method

danielt...@gmail.com

unread,
Jul 14, 2021, 11:46:01 PM7/14/21
to ResourceSpace
Found myself setting this up today and recalled this thread. In the current version of Postman this is easily handed via a pre-request script. Here's what mine looks like in case its helpful, just be sure to replace the api_key with the actual value attached to the user sending the request and to exclude the "sign" param from the list in the params tab, or else it will be added twice.

const api_key = "apikey1234replacethis"
let querystring = pm.request.url.query.toString()
let sign = CryptoJS.SHA256(api_key+querystring).toString()
pm.request.url.query.add({key: 'sign', value: sign})

Dan
Reply all
Reply to author
Forward
0 new messages