Custom app and API integration

Job ID: 33235961

Budget: ₹1,500 – ₹12,500 INR

I have a supplier that offers their personalisation preview tool through their API. They informed the API isn't native to Shopify, so it would require some tweaking. This is the suppliers website and if you go down and type in something and click "Enter" it will generate a preview for the typed term on the product through the API. (https://www.personalise.co.uk/all-gifts/candles/candle-holders/personalised-home-white-wooden-tea-light-holder.html).

I have all the product feed CSV including the characters limits and lines for each products. They informed that "If you are able to convert the code into whatever development environment you are using, we will be able to set you up your own credentials" and included with below a python example to make personalisation image requests. They also informed for the question "Do I have to write 500 codes for 500 products each to request preview for each product? – No they will use the variable from said products to insert into the code. So one piece of code many variables."
They said the way to go would be creating a custom app to integrate the API. This is all the information I have at the moment but if this seems something you can help please respond with "LONDON" and then I can add you in the email and you can discuss with them directly.

Cheers,
Dee


import hashlib
import urllib.parse


def printgeneration():

username = 'SealAccount'
public_key = '3169D9B8'
secret_key = "B4F74C611688304783834DC103C97E0F86C2C18C9014734E"

pers_sku = 'P071176'
pers_line1 = 'Mr & Mrs Eaton'
pers_line2 = 'Lots of Love x'


stringtohash = """set{}tPers{{$Line1={};Line2={}$}}pw600co80u{}{}""".format(pers_sku, pers_line1, pers_line2, username, secret_key)

stringtohashplaceholder = """set{product_sku}tPers{{$Line1={personalisation}$}}pw600co80u{username}{secret_key}"""
print(stringtohash)

print('These are my Variables.....')
print(' ')
print('Username: {}'.format(username))
print('Product Sku : {}'.format(pers_sku))
print('Personalisation : Line 1 {} Line2 {}'.format(pers_line1, pers_line2))
print('')
print('Secret Key : {}'.format(secret_key))
print('Public Key : {}'.format(public_key))

print('')
print('This is my string to hash with placeholders.........')
print(stringtohashplaceholder)
print('')
print('This is my string to Hash')
print('{}'.format(stringtohash))

encypter = hashlib.md5(stringtohash.encode())
value = encypter.hexdigest()

print('This is my hashed string....'.format(value))
print('{}'.format(value))

print('')
print('This is the final url with the Seal you have created above added to the request string...')

pers_string = "{{$Line1={};Line2={}$}}".format(pers_line1, pers_line2)

pers_for_main_url = urllib.parse.quote_plus(pers_string)
#Pers{$ Line1 =Phillip$}
final_url = 'https://preview.personalisedmemento.co.uk/dsmo/streamimage.aspx?set={}&t=Pers{}&pw=600&co=80&u={}&Seal={}'.format(pers_sku, pers_for_main_url, username, value)
print(final_url)



pass







if __name__ == '__main__':
printgeneration()