'Trsutpilot generate invitations API: error 403
I am trying to use Trustpilot's "Generate invitation links using Trustpilot APIs" for service review links. I managed to get the BUID and access_token, however when trying to generate the link I get an empty 403 error. I have tried several different setups including leaving out the API key and using Basic instead of Bearer but that then just leads to 401 errors. I also checked that the access_token hasn't expired.
#get the unique link
access_token = json.loads(response.text)['access_token']
businessUnitId = "XXX"
invitation_url = "https://invitations-api.trustpilot.com/v1/private/business-units/{businessUnitId}/invitation-links"
payload = {
"referenceId": "inv00001",
"email": "[email protected]",
"name": "John Doe",
"locale": "en-US"
}
head={"apikey": "secret_api_key",
"Authorization": "Bearer {access_token}"
}
response = requests.post(url = invitation_url, data = json.dumps(payload), headers = head)
status_code = response.status_code
I am relatively new to APIs so would really appreciate any kind of hint what is going wrong here! Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
