5 Replies - 130 Views - Last Post: 26 November 2017 - 03:15 PM Rate Topic: -----

#1 t3cho  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 225
  • Joined: 27-May 14

Send api request with quotes

Posted 26 November 2017 - 12:39 PM

So with this code i send the api call to zoho creator and everything works as a charm if i send request with
ebayNumber value digits only.


Try
            Dim TargetURL As String = "https://creator.zoho.com/api/json/" & myCfg.ZohoAPP & "/view/" & myCfg.ZohoReport & "?authtoken=" & myCfg.ZohoToken & "&scope=creatorapi&zc_ownername=" & myCfg.ZohoUser & "&criteria=(New_Ebay_Tracking_number==" & ebayNumber & ")&raw=true"
            Dim httpReq As Object
            httpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
            httpReq.Open("GET", TargetURL, False)
            httpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
            httpReq.send("")

            Dim response As String = httpReq.responseText

        Catch ex As Exception
            WriteLog("Error during check item on ZOHO " & ex.Message)
        End Try


If i enter the char it does not produce the value and response is error. So with postman tests i figured out that i need to put Quotes around ebayNumber

So i tried with
(New_Ebay_Tracking_number==""" & ebayNumber & """)



but in this case i dont get the response at all.

If i send the request with POSTMAN i get the json response. But if i sent the request with VB.net the response is nothing.

Is This A Good Question/Topic? 0
  • +

Replies To: Send api request with quotes

#2 andrewsw  Icon User is online

  • blow up my boots
  • member icon

Reputation: 6444
  • View blog
  • Posts: 26,066
  • Joined: 12-December 12

Re: Send api request with quotes

Posted 26 November 2017 - 01:38 PM

One simple thing I would try would be to use single quotes.

Then urlencode the string, probably via WebUtility.UrlEncode or similar.
Was This Post Helpful? 0
  • +
  • -

#3 Radius Nightly  Icon User is offline

  • D.I.C Head

Reputation: 19
  • View blog
  • Posts: 207
  • Joined: 07-May 15

Re: Send api request with quotes

Posted 26 November 2017 - 02:57 PM

Im not sure (and not into VB too much), but you can try this, try to use \" (it should make " sign) or "\"" (so only sign " will be set). Its similar functionality as \r\n for new line or \t for tab.
For example, if you wanna print out:
this"h"e"he

in your chase, it would be something like:
"this\"h\"e\"he"

or:
"this" & "\"" & "h" & "\"" & "e" & "\"" & "he"


Shortly, try edit this:
""" & ebayNumber & """

to this:
"\"" & ebayNumber & "\""


You can also try with:
"\" & ebayNumber & \""

if VB.NET supports it.

This post has been edited by Radius Nightly: 26 November 2017 - 03:04 PM

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • blow up my boots
  • member icon

Reputation: 6444
  • View blog
  • Posts: 26,066
  • Joined: 12-December 12

Re: Send api request with quotes

Posted 26 November 2017 - 02:59 PM

That doesn't apply to VB.NET, doubling up "", as the OP has it, creates the required quote character.
Was This Post Helpful? 0
  • +
  • -

#5 Radius Nightly  Icon User is offline

  • D.I.C Head

Reputation: 19
  • View blog
  • Posts: 207
  • Joined: 07-May 15

Re: Send api request with quotes

Posted 26 November 2017 - 03:12 PM

I wasnt doubling it, \t for tab, \r or \r\n for new line, \" for quote.
But it looks like that, typing out "\t" for tab, is same as "\r\n" for new line, same as "\"" for quote.
Im not into VB.NET so maybe it wont work. But i dont think "" will make a quote, same as """ (probably error maker), wont work.
Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is online

  • blow up my boots
  • member icon

Reputation: 6444
  • View blog
  • Posts: 26,066
  • Joined: 12-December 12

Re: Send api request with quotes

Posted 26 November 2017 - 03:15 PM

Again, that doesn't work in VB. Try it. It was the OP who I said was correctly doubling-up on the quotes.

Quote

Im not into VB.NET so maybe it wont work.

There is nothing preventing you from testing in Visual Studio or some online editor, particularly as you are not into the language.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1