0

How can I build macros with no scope id?

Juan (Comunica Translations) 3 months ago in API updated 2 months ago 2

Hello:

I was wondering if there is a way to execute a macro without having to have a scope. It's to mostly use it through the API.

For example, now I am trying to build a macro that accepts the projectId (in my case YYYY/NNNN), searches for it and returns the project information. In this case, what the Project's scope is waiting for, is the internalId (XXXXX). But in my case, I don't need to specify any ids (for the scope). Only a parameter with the ProjectId.

Thanks a lot.

My best regards.

Hi Juan,

here's a brief description from Thijs Senten:

https://xtrf.userecho.com/communities/8/topics/2042-how-to-execute-the-macro-api-parameterized#comment-7175

Basically, when executing the macro via the API, you can add additional JSON arguments to the `params` parameter and use them in the macro.

The list of `ids` that XTRF expects is available in the `list` variable in the macro – you can ignore this completely though and just us the arguments from `params`. I'm not sure if an input is required for `ids` – if so, you might just try passing `[0]`, or the valid ID of some project, since you are ignoring it in your macro, it wouldn't really matter.

Best,

-Ben

Wonderful. Thanks for your answer, Ben.

I decided to have a "dummy" project in my XTRF. Then I always attack a macro with the Scope "Projects" and always give that projects ID.
Then, inside the macro, I do whatever I want.

My best regards.
Juan.