Skip to Content
Jul 29, 2022 at 07:41 PM

RESTful API BO 4.3 - 415 Unsupported Media Error From Creating Crystal Report Schedule

252 Views Last edit Aug 10, 2022 at 03:17 PM 4 rev

BO 4.3.

I'm trying to add a schedule to an existing crystal report using the REST API. I'm able to log into the server and retrieve a token, retrieve documents and their schedules along with details, but I'm unable to send a post request to add a new one. I get 415 error - unsupported media type. I was able to post a new publication successfully but we are needing to add new schedules to crystal reports. SAP documentation seems specific to Webi reports, but SAP support says this is also possible for crystal; however, they haven't been able to tell me what I'm doing wrong yet.

Referencing SAP's own documentation, I used their exact sample for creating a schedule with email destination located here: Example - Mail Destination for a Hourly Schedule.

I tried this for a crystal and webi report, and I still get the same 415 error. Could someone please tell me what I'm doing wrong?

Here is my code written in python:

Token Retrieval:

import pandas as pd<br>import numpy as np<br>import requests<br>import json<br>
# retrieve login token<br>url = 'http://redacted:8080/biprws/logon/long'<br><br>headers = {<br>    "Accept": "application/json",<br>    "X-SAP-TRUSTED-USER": "redacted",<br>    "Content-Type": "application/xml"<br>}<br>body = f"""<br><attrs xmlns=""><br>    <attr name="password" type="string">redacted</attr><br>    <attr name="clientType" type="string">user</attr><br>    <attr name="auth" type="string" possibilities="secEnterprise,secLDAP,secWinAD,secSAPR3">secEnterprise</attr><br>    <attr name="userName" type="string">redacted</attr><br></attrs><br>"""

res =, body, headers=headers)<br><br>res = json.loads(res.text)<br>token = res['logonToken']

Schedule retrieval:

headers = {<br>    "Accept":"application/xml",<br>    "X-SAP-LOGONTOKEN":f"{token}"<br>}<br>url = f'http://redacted:6405/biprws/raylight/v1/documents/3127507/schedules/3361229'<br>resp = requests.get(url, headers=headers)<br>print(resp.text)


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <format type="txt"/>
    <status id="9">Recurring</status>
    <destination keepInstanceInHistory="true">
        <useSpecificName fileExtension="false">%SI_NAME%_%SI_STARTTIME%.txt</useSpecificName>
    <weekly retriesAllowed="0" retryIntervalInSeconds="1800">
    <serverGroup id="0" required="false"/>

Here is my post attempt:

url = 'http://redacted:8080/biprws/v1/documents/3127507/schedules'<br><br>headers = {<br>    "Accept":"application/json",<br>    "X-SAP-LOGONTOKEN":f"{token}",<br>    "Content-Type": "application/xml"<br>}<br><br>body = """<br><schedule><br>    <name>RevintHB-Account</name><br>    <format type="csv"/><br>    <status id="9">Recurring</status><br>    <destination keepInstanceInHistory="true"><br>        <useSpecificName fileExtension="false">%SI_NAME%_%SI_STARTTIME%.txt</useSpecificName><br>        <mail><br>            <from></from><br>            <to></to><br>            <cc></cc><br>            <subject>%SI_NAME%</subject><br>            <message>hello this is the message</message><br>            <addAttachment>true</addAttachment><br>        </mail><br>    </destination><br>    <hourly retriesAllowed="0" retryIntervalInSeconds="1800"><br>        <startdate>2022-04-30T16:00:00.000Z</startdate><br>        <enddate>2031-03-10T18:38:00.000Z</enddate><br>        <hour>1</hour><br>        <minute>0</minute><br>    </hourly><br></schedule><br>"""<br>resp =, body, headers=headers)<br>print(resp)

Any help is appreciated!