Hi @idziemianczyk,
My colleague @CindyWong attempted to reply to your inquiry, but experienced technical issues. She forwarded me her response in the meantime and I'll place it below.
- The codes you pasted are only to create a report object. In order to open the report in VA, you need to create the report content object ahead, and hook the two together. About the relationship between report object and the report content object, please see the chart in the composition of a report object in Discover Visual Analytics Report Paths with REST APIs - SAS Users.
- We can create a new report or create copy existing report using REST API. Below codes for your reference:
/* retrieve the report content object from an existing report */
%let BASE_URI=%sysfunc(getoption(SERVICESBASEURL));
FILENAME rContent TEMP ENCODING='UTF-8';
PROC HTTP METHOD="GET" oauth_bearer=sas_services OUT= rContent
URL = "&BASE_URI/reports/reports/ffb113b7-9cfa-434b-99f1-9b3fe5a9f340/content";
HEADERS "Accept" = "application/vnd.sas.report.content+json";
RUN;
/* create a new report object in a folder */
FILENAME tReport TEMP ENCODING='UTF-8';
FILENAME hdrout TEMP ENCODING='UTF-8';
PROC HTTP METHOD = "POST"
URL = "&BASE_URI/reports/reports?parentFolderUri=/folders/folders/dbbc365c-69dc-4e3f-97c9-49818029fde1"
OUT = tReport HEADEROUT=hdrout
OAUTH_BEARER = SAS_SERVICES
IN = '{
"name": "Report by API",
"description": "Create Report from REST API"
}' ;
HEADERS "Accept" = "application/vnd.sas.report+json"
"Content-Type" = "application/vnd.sas.report+json" ;
RUN;
/* print the response header, and get the value of 'ETag' and 'Last-Modified' */
data _null_;
infile hdrout;
input;
put _infile_;
run;
/* save the retrieved report content object to the newly created report */
/* need to replace the IF-MATCH value with the value of ‘ETag’ from previous response header */
/* need to replace the IF-UNMODIFIED-SINCE value with the value of ‘Last-Modified’ from previous response header */
PROC HTTP METHOD = "PUT"
URL = "&BASE_URI.&rptid/content"
OAUTH_BEARER = SAS_SERVICES
IN = rContent ;
HEADERS "Accept" = "*/*"
"Content-Type" = "application/vnd.sas.report.content+json"
"IF-MATCH" = """kjv0va4n"""
"IF-UNMODIFIED-SINCE" = "Wed, 13 Jan 2021 06:07:37 GMT"
;
RUN;
/* Now you should be able to open the new report in VA */