Rest API - Pass parameters

I wanted to make this as broad a title as possible. I'm shocked I can't find anything on this. I don't want to use the ID. Seems everything is bound to ID.

I just want to simply know, without use of ID, how a method can consume arguments? How to pass/use arguments?

My particular use case is one to squash annoyance. I think many, if not all, Item Types should have Auto-Search set to true. I find it silly UX to go to, "Search 'Some Item Type'" and then need to click search. So, I'm finding I need to navigate to the IT definition and check the box and save the edit.

I just want to use PostMan to pass an ItemType by name. I don't know how to do that or extrract that from the call.

I want to pass the IT name. So, something like this for the IT "Method":

{{base_url}}{{version}}/server/odata/method._Set_Auto_Search_True('method')

But, how? Hmmm. Maybe a where clause somehow?

.../odata/ItemType?$filter=name eq 'method'

Anyway, any help passing other-than-id params to a function would be great!

Parents
  • Setting auto-search to 1 for all ItemTypes will probably not work so easy. You will have to skip all core itemtypes and there are a few where it´s more recommended not to use this setting cause of performance reasons.

    Filter is used for searching a particular table entry. Don´t use '' or "" for searching, e.g.:
    .../server/odata/User?$filter=login_name eq admin

    Parameters to a Method can be passend within the body. This sample worked for me: https://community.aras.com/b/english/posts/server-side-methods-with-the-aras-restful-api

    But why use REST for this use case at all? You can directly run your Method from the editor. Just ensure that you are the only person to access and execute, or just use it temporary.

  • 0 オフライン in reply to AngelaIp

    I want to use REST because it is so much faster, even on localhost. I don't know why and have posted about this before; well, I commented on a post where somebody has the same problem. It takes a minimum of 30 seconds to login. It takes the same to save a function. The post you pointed me to gave me what I needed. It all boils down to using POST with JSON and `this.getProperty("prop_name", "default_value")` to get the property. I've only done a proof of concept using strings. It would be so nice if this supported server side JS. But, yeah: this.getProperty("prop") was the key to moving forward. I just wanted to know how for future ops as well - especially setup for automation testing.


    /* 1st form
    var inn = this.getInnovator();
    return inn.newResult("Hello World");
    */
    // 2nd form - this.getProperty can get from a JSON property passed into call.
    Innovator inn = this.getInnovator();
    string to = this.getProperty("hello_to", "World"); // default to "World"
    return inn.newResult("Hello " + to + "!");
    
Reply
  • 0 オフライン in reply to AngelaIp

    I want to use REST because it is so much faster, even on localhost. I don't know why and have posted about this before; well, I commented on a post where somebody has the same problem. It takes a minimum of 30 seconds to login. It takes the same to save a function. The post you pointed me to gave me what I needed. It all boils down to using POST with JSON and `this.getProperty("prop_name", "default_value")` to get the property. I've only done a proof of concept using strings. It would be so nice if this supported server side JS. But, yeah: this.getProperty("prop") was the key to moving forward. I just wanted to know how for future ops as well - especially setup for automation testing.


    /* 1st form
    var inn = this.getInnovator();
    return inn.newResult("Hello World");
    */
    // 2nd form - this.getProperty can get from a JSON property passed into call.
    Innovator inn = this.getInnovator();
    string to = this.getProperty("hello_to", "World"); // default to "World"
    return inn.newResult("Hello " + to + "!");
    
Children
No Data