1 Reply Latest reply on Jun 19, 2015 4:55 AM by element14_Perks

    Retrieve contract prices


      I am trying to use my Farnell account to retrieve contract prices using the REST API. Using just the API key it is all working great. But when retrieving contract prices is not working yet. Am I missing something in the documentation? Initially I got an time invalid error, but after changing the timestamp to UTC the error was gone. Now acount information seems to be incorrect...


      Anyone has an idea what I am doing wrong?


      My implementation in Python 3 is shown below:

      # Get hmac sha1 code

          timestamp = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.000')


          key = '12345'     # My Farnell password

          message = 'searchByPremierFarnellPartNumber' + timestamp


          hashed = hmac.new(key.encode(), message.encode(),sha1)

          digest64 = base64.encodestring(hashed.digest())

          digest_utf = digest64.decode("utf-8").rstrip('\n')


          # Download data

          url = 'http://api.element14.com/catalog/products?'

          url += ('term=id%3A' + quote(pn))

          url += '&storeInfo.id=nl.farnell.com'

          url += '&resultsSettings.offset=0'

          url += '&resultsSettings.numberOfResults=1'

          url += '&resultsSettings.responseGroup=large'

          url += '&callInfo.omitXmlSchema=false'

          url += '&callInfo.responseDataFormat=json'

          url += '&callinfo.apiKey=' + api_key               # My element 14 API key

         url += '&userInfo.customerId=12345'          # My farnell acount number

          url += '&userInfo.timestamp=' + timestamp

          url += '&userInfo.signature=' + quote(digest_utf)



         data = urlopen(url, timeout=5).read().decode("utf-8")


      except HTTPError as err:



      response = json.loads(data)