MattParr / python-atws

Autotask Web Services python module
MIT License
32 stars 10 forks source link

Unable to integrate with Autotask #64

Closed natchu closed 5 years ago

natchu commented 5 years ago
import atws
at = atws.connect(username='...', password='...',  apiversion=1.5)
query = atws.Query('Ticket')
query.WHERE('id', query.Equals, XXX)
tickets = at.query(query).fetch_all()

The code keeps returning the same error

ERROR:atws.wrapper:IntegrationCode is invalid.
ERROR:atws.wrapper:<queryxml><entity>Ticket</entity><query><field>id<expression op="Equals">379277</expression></field></query></queryxml>

The error seems to occur when I try to use API version 1.5. If I use 1.6, with integration code it works

Also Suds version seems to come up as a warning.

Any help?

natchu commented 5 years ago

This is the error message :
atws.wrapper.AutotaskAPIException: 'Autotask API has returned an error.\n Please process the response attribute in this exception to determine\n the extent of this failure.\n '[IntegrationCode is invalid., '<queryxml><entity>Ticket</entity><query><field>id<expression op="Equals">379277</expression></field></query></queryxml>']

And the kwargs looks like the following:

{'atws_version': <class 'atws.wrapper.Wrapper'>, 'username': '...', 'password': '...', 'apiversion': 1.5, 'client_options': {'transport': <atws.connection.RequestsTransport object at 0x7f370ad67240>, 'url': 'https://webservices6.autotask.net/ATServices/1.5/atws.wsdl'}}

hoerup commented 5 years ago

If you have obtained an integrationcode then it must be supplied under 1.5 as well.

From api v1.6 documentation:

A tracking identifier is not required to access v1.5, unless the user accessing v1.5 already has an identifier assigned. In that case, the user is required to provide their identifier.

MattParr commented 5 years ago

I'll add that into the documentation.

natchu commented 5 years ago

If you have obtained an integrationcode then it must be supplied under 1.5 as well.

From api v1.6 documentation:

A tracking identifier is not required to access v1.5, unless the user accessing v1.5 already has an identifier assigned. In that case, the user is required to provide their identifier.

Thank you!

waldothedeveloper commented 5 years ago

@MattParr could you point me where in the documentation did you add the IntegrationCode????

also who can you choose between V1.6 or V.5 ?

MattParr commented 5 years ago

https://atws.readthedocs.io/usage.html#connecting-to-autotask

waldothedeveloper commented 5 years ago

@matt in your example of creating a ticket on the docs. I really can’t find the AccountID. I’ve googled and everything but nothing. I tried omitting the field but autotask api doesn’t like it. What is that AccountID my friend?

MattParr commented 5 years ago
query = atws.Query('Account')
query.WHERE('id',query.GreaterThan,0)
accounts = at.query(query)
# enumerate them
for account in accounts:
    print(account.id)