API/ Dataminer question

Could someone provide a sample of how to run the RunScreen api from within Portfolio123’s API page?As in the exact text. And not on Google colab, which I haven’t quite mastered, but on this page:

https://api.portfolio123.com/docs/index.html#/Screen/_run

Also, some clarification on these two questions would be helpful:

  1. Is the access token our ID or Key?
  2. Is it necessary to do anything first in the Authenticate section?

Thanks.

This may help you.
If you look under Account Settings → Dataminor and API, you will find your key API key and ID.

If you want to run it from that Swagger page, the steps are:

Go to the section for the /auth endpoint on that page. Click Try it Out.
Enter your API id and key in the apiid and apiKey fields. They will have 0 and “string” by default.
Click Execute. If there were no errors, the access token will be in the code 200 section. Copy the access token from the response body. The access token is a very long number. It is not the same thing as your api key.

Go to The Screenrun endpoint and click Try it Out.
Paste in the Access Token into the token field.
Change the request body to whatever you want to run. I used 30540 which is a p123 public screen. I deleted a few optional parameters:

{
  "pitMethod": "Prelim",
  "precision": 2,
  "screen": 30540,
  "asOfDt": "2023-03-19"
}

Click Execute and you will see the screen results in the Response body field.

This ‘Try it out’ functionality is okay to play with the API to get a sense of how it works, but to do anything useful with the API, you would be much better off installing a development environment like PyCharm.

Thanks, that’s very helpful.