Author Topic: API Script Parameter Problem  (Read 3454 times)

laboheme

  • Newbie
  • *
  • Posts: 1
    • View Profile
API Script Parameter Problem
« on: January 07, 2014, 02:33:23 AM »
Hi everyone,

I have some developers trying to implement the P2p-Picks API script but encountered the problem below. Bryce thought someone here might have found the solution? Thanks.

Today we get a problem about p2p-picks API. When we call
'/subscriber/validate' API from information in 'P2P-Picks.comAPI-v1-Documentation.pdf' file. This file has missed 'p2p_sid' parameter..
 
To connect '/subscriber/validate' successfully, we have to generate 'sig' from p2p_sid, api_key and secrect :
 
md5(“subscriber-validate&api_key8E3A85DA4D1D11&p2p_sid was missed&secretA04B39AC072988E4A7AF64DC5C49E60F”)
 
These 'api_key' and 'secret' were in 'Screen Shot 2013-11-24 at 9.44.25 PM.png' file.
 
I logged into your account on p2p-picks.com but I didn't find 'p2p_sid'. I think it is the private key. Could you ask them about 'p2p_sid' ?

Rob L

  • Hero Member
  • *****
  • Posts: 2117
    • View Profile
Re: API Script Parameter Problem
« Reply #1 on: January 07, 2014, 10:06:26 AM »
The POST parameters for /subscriber/validate are api_key, p2p_email, p2p_password and sig. To compute sig you need the md5 hash of api_key, p2p_email, p2p_password and api_secret. You don't need sid to generate sig. The response will contain sid. This help?

brycemason

  • Hero Member
  • *****
  • Posts: 801
    • View Profile
    • P2P-Picks.com
    • Email
Re: API Script Parameter Problem
« Reply #2 on: January 07, 2014, 10:45:57 AM »
Yep, I've checked this with my own API account. The instructions clearly state that each signing request takes as parameters the parameters for that particular API call. So, the /subscriber/validate call does not need the SID value. That's the output of that particular call.

Do the following to call /subscriber/validate correctly:

1) Generate an MD5 of your "base string" for your sig.

md5 -s "subscriber-validate&api_keyABC123&p2p_emailyouremail@address.com&p2p_passwordyourpw&secretDEF456"

2) Take that hash and add it to the /subscriber/validate call

curl -d "p2p_password=ABC123&p2p_email=soandso@wherever.com&api_key=ABC123&sig=thehashabove" https://www.p2p-picks.com/api/v1/subscriber/validate

3) The response will be:

{"meta":{"status":200,"msg":"OK"},"response":{"sid":"tadahereisyoursid","status":"active"}}

« Last Edit: January 07, 2014, 11:43:46 AM by brycemason »