Need some help getting started
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Need some help getting started
Can anyone help me get started? I am trying to get a connection to the web API for Autotask. I'd like to just make a simple stack with a login button and then a query button with an output list. I have all of the sample code to make this happen but I'm unsure how to get going in LC. For some reason the forum won't let me post the code. I can send it to you. Thanks in advance.
Re: Need some help getting started
Hi.
I seem to remember that there is a minimum number of posts required before you can attach a file, but do not think there is one preventing you from using the "
I seem to remember that there is a minimum number of posts required before you can attach a file, but do not think there is one preventing you from using the "
Code: Select all
" tags. If I am wrong, though, simply post it in the clear, as text.
Craig Newman
Re: Need some help getting started
Thanks. No matter if it's plain text or within the "code" I get this when I try to post - Your account does not have permission to post links or domain/page references.
Re: Need some help getting started
But you are posting already. Did you mean you could not attach a file when you said you could not post "code"?
Craig
Craig
Re: Need some help getting started
I can post regular text but if I try to put in the sample code I have it gives me this error when I try to click to submit. I can just email it to you if you'd like.
Re: Need some help getting started
There is a URL in rflud code.
Can't post it yet or change the url to w w w . s o m e. c o m (spaces between the letters).
Simon
Can't post it yet or change the url to w w w . s o m e. c o m (spaces between the letters).
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Need some help getting started
I found the lines that were causing the problem. I noted them with "**************" I had to add a space after the periods and break up the URL.
Dim strWebURI As String = "h t t p s: / / webservices5 . autotask . net / atservices / 1 . 5 / atws . wsdl" *******************
Dim myService As New WebReference.ATWS
myService.Url = strWebURI
Dim cred As New System. Net. NetworkCredential("myUserName at domain . com", "myPassword") *******************
Dim credCache As New System. Net. CredentialCache ***********************
credCache.Add(New Uri(myService.Url), "Basic", cred)
myService.Credentials = credCache
and here is the code to run a query for accounts.
Dim boolQueryFinished = False
Dim strCurrentID As String = "0"
While Not (boolQueryFinished)
Dim strQuery As String = "<queryxml><entity>Account</entity>" & _
"<query><field>id<expression op=""greaterthan"">" & strCurrentID & "</expression></
field></query>" & _
"</queryxml>"
Dim r As myWS.ATWSResponse
r = myService.query(strQuery)
If r.EntityResults.Length > 0 Then
For Each ent As myWS.Entity In r.EntityResults
' execute some code on the current account
Console.WriteLine(CType(ent, myWS.Account).AccountName)
Console.WriteLine(ent.id)
strCurrentID = ent.id
Next
Else
boolQueryFinished = True
End If
End While
Dim strWebURI As String = "h t t p s: / / webservices5 . autotask . net / atservices / 1 . 5 / atws . wsdl" *******************
Dim myService As New WebReference.ATWS
myService.Url = strWebURI
Dim cred As New System. Net. NetworkCredential("myUserName at domain . com", "myPassword") *******************
Dim credCache As New System. Net. CredentialCache ***********************
credCache.Add(New Uri(myService.Url), "Basic", cred)
myService.Credentials = credCache
and here is the code to run a query for accounts.
Dim boolQueryFinished = False
Dim strCurrentID As String = "0"
While Not (boolQueryFinished)
Dim strQuery As String = "<queryxml><entity>Account</entity>" & _
"<query><field>id<expression op=""greaterthan"">" & strCurrentID & "</expression></
field></query>" & _
"</queryxml>"
Dim r As myWS.ATWSResponse
r = myService.query(strQuery)
If r.EntityResults.Length > 0 Then
For Each ent As myWS.Entity In r.EntityResults
' execute some code on the current account
Console.WriteLine(CType(ent, myWS.Account).AccountName)
Console.WriteLine(ent.id)
strCurrentID = ent.id
Next
Else
boolQueryFinished = True
End If
End While
Re: Need some help getting started
Can anyone turn this code into a working stack? Or at least point me in the right direction?