microsoft / skype-interviews-docs

Sample code showcasing how to use the Skype Interviews API
MIT License
12 stars 14 forks source link

automatic date scheduling not working #14

Open StanleyBlack1 opened 5 years ago

StanleyBlack1 commented 5 years ago

I am trying to integrate Skype interview API using python and JWT.

for this 1st I am creating a token using python and jwt, and after that, I am sending API request call to skype interview with generated above token.

the request is processed and I am getting a proper response. the scheduling is set to automatic and date proposing is set to the candidate.

my issue is instead of the candidate to get the date proposing email the interviewer is getting the date selecting email without even proposing the date by the candidate.

You can see/check below my code:


`input_data = {

"iemail": "interviewer@email.com",

"iduration": 90,

"cname": "Candidate",

"location": "LOCAL"

"position": "Full Stack Developer",

"cemail": "candidate@email.com",

"iname": "Interviewer"

}

def payloadGenertor(content):

jti = uuid.uuid1()

iss = "ISSUER"

iat = int(datetime.now().timestamp())

sub = hash256(content)

exp = iat+10

payload = {

"jti": f'{jti}',

"iss": f'{iss}',

"iat": iat,

"sub": f'{sub}',

"exp": exp

}

payloadStr = json.dumps(payload)

return payloadStr

url = "https://interviews.skype.com/api/interviews"

content = {

"position" : {

  "code": input_data['location']+" "+str(uuid.uuid1()).split('-')[0],

  "title": input_data['position'],

  "Description": f"Interviews for {input_data['position']} {input_data['location']}."

},

"participants": [

{

  "name": input_data['iname'],

  "email": input_data['iemail'],

  "role": "interviewer",

  "timezone": "Asia/Kolkata"

},

{

  "name": input_data['cname'],

  "email": input_data['cemail'],

  "role": "candidate",

  "timezone": "Asia/Kolkata"

}

],

"scheduling": {

"duration": int(input_data['iduration']),

"mode": "automatic",

"dateproposing": "candidate"

}

}

secret = "API_SECRET"

payloadHeader = {

"alg": "HS256",

"typ": "JWT"

}

payload = payloadGenertor(content)

jwt = generate_JWT(payloadHeader, payload, secret)

headers = {

'Content-Type': 'application/json',

'Authorization': 'Bearer ' + jwt

}

response = requests.post(url, data=content,headers=headers)

print(response.text)`