Recent searches


No recent searches

Response 204 using Redirect Rules API in Early Access



Posted Apr 18, 2024

We are currently testing the RedirectRules API in Early Access. We use Python for that my code looks equal to the sample in the API documentation, excluding the authentication. This is because we use SingleSignOn. This works with other scripts we use. Thus I would exclude this as cause.

import requests
import json

zendesk_subdomain = 'xxx'
zendesk_authorization = 'Basic xxx'

url = 'https://' + zendesk_subdomain + '.zendesk.com/api/v2/guide/redirect_rules'

# Set the request headers
headers = {
	'Authorization': zendesk_authorization,
	'content-type': 'application/json'
}

payload = json.loads("""{
  "redirect_rule": {
      "redirect_from": "/hc/en-us/articles/4403403468690",    
      "redirect_status": 301,    
      "redirect_to": "https://<our_domain>/contact_us"  
      }
    }""")

response = requests.request(
    "POST",
    url,
    headers=headers,
    json=payload
)

# Check for HTTP codes other than 200
if response.status_code != 200:
    print('Problem with the request.')
    print('Status:', response.status_code)
    print('reason:', response.reason)
    print('content:', response.content)
    exit()

# Report success
print('Successfully redirected')

 

I get following response

Problem with the request.
Status: 204
reason: No Content
content: b''

 

If I search afterwards for Redirect Rules, it is shown, but the redirect didn't work.

 

Deleting the Redirect Rule using the API also returns a 204, but the Redirect Rule cannot be found with the search afterwards.

 

Any hints?


0

2

2 comments

image avatar

Greg Katechis

Zendesk Developer Advocacy

Hi Torsten! Since this is an EAP, we typically provide you with a dedicated forum or contact email anytime you're encountering issues. When you signed up, did you receive any information about where to provide bug reports? I've been looking around myself and I haven't been able to find anything, however that may be a result of my account not being enrolled. If you didn't get any specific instructions, let me know and I'll see what I can find for you!

0


Greg Katechis There was no dedicated forum or contact email provided. I wrote a mail to the person, which informs us, that Custom URL Redirects API is enabled for our account, but didn't receive any response so far.

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post