workfront-api icon indicating copy to clipboard operation
workfront-api copied to clipboard

Feature: Event Subscription API

Open heakinakai opened this issue 8 years ago • 3 comments

Hi,

Can we have the Event Subscription API added to the class for us Node server users?

I would like to be able to use the workfront api class to register, list, remove event subscriptions.

I have already written this into a forked version of the repository, but not written any tests or Documentation for it yet. I didn't really go any further than writing it for my own use as I'm not sure you accept outside pull requests. Happy to contribute if you would like me to.

Please let me know if this is something you plan on adding.

heakinakai avatar Mar 19 '18 13:03 heakinakai

Hi,

We'll be very thankful for any contribution. Please open a pull request from your fork in order to let us to review the changes. That will also kick CI tests.

On Mar 19, 2018 17:22, "heakinakai" [email protected] wrote:

Hi,

Can we have the Event Subscription API added to the class for us Node server users?

I would like to be able to use the workfront api class to register, list, remove event subscriptions.

I have already written this into a forked version of the repository, but not written any tests or Documentation for it yet. I didn't really go any further than writing it for my own use as I'm not sure you accept outside pull requests. Happy to contribute if you would like me to.

Please let me know if this is something you plan on adding.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Workfront/workfront-api/issues/263, or mute the thread https://github.com/notifications/unsubscribe-auth/AHGvCpwtHSOx__LLLEEOoAP90xUHJ_V4ks5tf7EUgaJpZM4SwJiX .

bhovhannes avatar Mar 19 '18 18:03 bhovhannes

Thanks, I'm re-writing now to be more in line with the original style of the library.

Few questions.

As you may know, the Event Subscription API is laid out differently to the standard API.

  • It's not part of 9.0 api and has no object reference.
  • It's authorized using the API key with the Header "Authorisation"
  • it does not match any of your current post body methods in the request method
  • it does not return a data object, it returns json with no key

all the above means I have 2 options.

  1. make the request method more complaint with both API's
  2. Add a separate fetch method to my event method and bypass the global request method

Also above I mentioned Authentication. The user would have to use method 'getApiKey' before event method instead of login, as it requires a different level of authorization.

You can see my original version here https://github.com/heakinakai/workfront-api (still re-writing it properly)

At the moment it is as follows:

new Interface

interface IEventAction {
create: (objCode: string, event: string, url: string, authToken: string, objId?: string) => Promise<any>
list: () => Promise<any>
remove: (subscriptionId: string) => Promise<any>
get: (subscriptionId: string) => Promise<any>
}

new methods

workfront.getApiKey(user, password).then(() => {
    workfront.event.create()
    workfront.event.list()
    workfront.event.remove()
    workfront.event.get()
})

heakinakai avatar Mar 21 '18 12:03 heakinakai

@heakinakai , unfortunately I am not super aware of what Event Subscription API is, however, taking into account the differences from standard API you've mentioned, I am thinking more about publishing a separate package which will deal with event subscriptions and has workfront-api as a dependency rather than modifying existing code.

@citizensas , any ideas on this?

bhovhannes avatar Mar 26 '18 12:03 bhovhannes