Home General Discussion
Options

Changing Config Item Relationships with the V3 API / Authentication Token for V3

Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
edited February 2 in General Discussion

Hy guys,

in our IT we have a big project running, where we are building up all new Business Services, and in that process want to bury our "old ones".

In that process we also want to move the creation of Services away from Service Manager to our Enterprise Architecture Management Tool ADOIT. Still we want the Services to be present in our SCSM CMDB and also want changes made to the Service via ADOIT to be present in SCSM. Changing the name or other string fields, or even enumerations, is not a problem and we have done that with the V3 API lots of times. What concerns me is the Owned By Relationship. I mean I would have to get the Service first, change the relationship in the JSON (which might be the challenging part) and then send it to the API via Commit. Has anyone else done that before? I mean the REST Calls will be made via script, so if there is no solution for that, we could still change the relationship via SMLets, but we wanted to move away from that and use the API when accessing or modifying data from/in SCSM.

The second question goes to the Cireson guys. Do you guys plan implementing the possibility to use Authentication Tokens (as for the Cloud Connector) for the V3 API as well? Our security guys are not very pleased when we write usernames and passwords directly into scripts in order to receive a token for that API.

Best Answer

Answers

  • Options
    Geoff_RossGeoff_Ross Cireson Consultant O.G.

    Hi Simon,

    Changing the relationship using the commit API will work fine. You only need the BaseId property, not the whole user object. Just make sure the relationship you are writing is in the NameRelationship array too.

    As for tokens for the v3 APIs - I think what is more likely will be new Cloud Connector token APIs for creating and updating CIs. Then you can move away from the legacy commit API.

    You'll see this in the "Planned" section of the 2024 roadmap.

    https://community.cireson.com/discussion/6690/2024-roadmap#latest

    Geoff

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    @Geoff_Ross thanks for the answer. Will check that out and also looking forward to the new functionality :)

    Another thing with the v3API is the Team Work/My Work etc. Endpoint. We are planning on showing SCSM Tickets in Confulence/JIRA via an Extension for Teams or Analysts. For that I guess we would have to use the V3 API, and therefor using a token would be perfect. So in general being able to use tokens in the V3 API would be very helpful. I mean recently I tried the .../platform/api... and there is a Team Work Endpoint as well. But how would I be able to use a filtering etc there? Are there any KB articles?

  • Options
    Geoff_RossGeoff_Ross Cireson Consultant O.G.
    Answer ✓

    Hi Simon,

    Take a look at this:

    Geoff

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    @Geoff_Ross Short question, I tried the call in postman but I am not receiving anything back.

    I guess I have to add the userId so I receive the work items that would be shown in my work/ Team work. What parameter do I have to use?

    I tried https://itportal.engel.int/platform/api/TeamWork?$filter=UserId%20eq%#USERID

    but I receive that error:

    {
        "error": {
            "code": "",
            "message": "The query specified in the URI is not valid. Could not find a property named 'UserId' on type 'PlatformCache.Data.Models.MyWorkModel'."
        }
    }
    

    Could you help me with that? :D

  • Options
    Geoff_RossGeoff_Ross Cireson Consultant O.G.

    Hi Simon,

    The TeamWork endpoint knows who you are and therefore does all the filtering to show only your work for you. You don’t need to add a filter for user. You might want to add one for status etc though.

    Geoff

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    hm strange, my result is always empty, no matter if I use a filter for e.g. status or just use it without any :/

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    @Geoff_Ross Is there something I am missing? As soon as I use the endpoint directly via the portal in my browser I receive a response. When I send a Rest Call via postman, I receive an empty result, doesn't matter if Team Work or My Work. May it be that this doesn't work from external, as the portal does not know which user has sent the request? Is there some way to include the username in the header or something like that?

  • Options
    Geoff_RossGeoff_Ross Cireson Consultant O.G.

    Simon, how are you Authenticating?

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    I am authenticating with the token I created inside the portal under "Authentication Token". But as you ask, I guess this one only applies to the cloud connector endpoint and not the platform :D
    The thing is, we don't want to write a user password into a script or something, like it was needed to receive a token in the V3 API :/

  • Options
    Geoff_RossGeoff_Ross Cireson Consultant O.G.

    Hi Simon,
    These endpoint also need the Authentication Token, not the old v3 api method but the Auth Tokens are user contextual. So if you created it with an admin account and then use it to get "My Work" its probably going to be blank.

    Where are you ultimately going to be making this call from?

    Geoff

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    A goal is to add a table view from my work / my requestes etc. to a jira/confluence page to have all the work together :)
    Therefor we need the functionality to return the work based on the user who opens Jira or Confluence. Is that even possible?

Sign In or Register to comment.