BookmarkSubscribeRSS Feed
Ullsokk
Pyrite | Level 9

I am using the following to get project and model id:

%let uri =/modelRepository/projects/;

proc http url="https://myviyaserver&uri." 
method="GET" 
auth_basic
headerout=hdrs
headerout_overwrite
out=Respout;
headers "Authorization"="Bearer &access_token."
"Accept" = "application/json"
;
run;

I then use the following to find the model id of the champion model:

 

%let uri =/modelRepository/projects/&id./champion;

proc http url="https://myviyaserver&uri." 
method="GET" 
auth_basic
headerout=hdrs
headerout_overwrite
out= model&i.;
headers "Authorization"="Bearer &access_token."
"Accept" = "application/json"
;
run;

I then try to use the API score code with the returned values. Have tried using both externalmodelid  and then id, but both return a 404 error. If I on the other hand find the same model in model studio, and under pipeline comparison look at the API score code, both the project id and model id is something completely different. The score API works on those values, but I cant find those values using this API. So I guess I either have to find the project and model id that is in model studio (not registered models from the model repository), or find the correct paths to use the api score code using the modelRepository ids? 

 

The API score code uses the following path:  

%let scoreModelUrl=&servicesBaseUrl.dataMining/projects/&projectId/models/&modelId/scoreExecutions;

But i cant find a GET request that works on that path, eg.g dataMining/projects/&projectId/. 

What does the URL have to be to get the API score code to work for a modeRepository/&projectId/?

3 REPLIES 3
joeFurbee
Community Manager

Hi @Ullsokk

I'm contacting someone about the data mining APIs, and the validity of the uri: GET /datamining/projects/{projectId} endpoint. 

 

If you need score code from model repository, /modelRepository/models/&modelId/code will get the model score code. For the champion code in model repository, /modelRepository/projects/&projectId/champion/code will get the champion model score code.

 

When getting the project from Model Manager, when that project was registered by Model Studio there is an externalProjectId similar to the externalModelId in the model you reference. You would want to use the externalProjectId that is associated with the Model Manager project and not use the id.


Join us for SAS Community Trivia
SAS Bowl XLIII, The New SAS Developer Portal
Wednesday, August 14, 2024, at 10 a.m. ET | #SASBowl

Ullsokk
Pyrite | Level 9

Thank you! I now get a returned score file that I cant quite recognize, starting with

package MS_lotsofstrings_22SEP2020100924511 / overwrite=yes;
dcl package score _lotsofstrings();


I have the models as a filename model&i. temp. Do I need to store the files physically in a .sas format to work?
How do I use this code? Doesnt seemt to be an astore, and the good old %include after a set statement does not work for me. Event tried saving to a .sas file and putting a data and set statement before the code, but get the following errors:

ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase.
ERROR 180-322: Statement is not valid or it is used out of proper order.
ERROR 565-185: PACKAGE is not a known class name.
Ullsokk
Pyrite | Level 9

@joeFurbee Tanks for the input so far. But I can't get the code from the API to work. I can't seem to find out what kind of code this is, and how to run it. Any input would be much appreciated. What I am basically asking, is what to do after retrieving the score code using  /modelRepository/projects/&projectId/champion/code

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1180 views
  • 0 likes
  • 2 in conversation