[AccessD] A2003: POST a set of params to a Web Resource

Darren - Active Billing darren at activebilling.com.au
Sun Jul 14 23:19:25 CDT 2019


Frustratingly - This exact block of text works fine in a Terminal Session on a Mac

curl -XPOST -H "Content-type: application/json" -d '{"text": "This is the Task Name for Task No: 4","description": "This is the Task Description for Task No: 4","dueDate": "2019-10-07"}' 'https://hooks.workast.app/Do7DOEFPZDzAS20cvtt6E'

but I can’t get it to run in a Windows command window using some "curl.exe" executable I grabbed from the web.

Anyone know how I might get it to run in a batch file?

Many thanks.
 
Darren. 


On 15/7/19, 1:39 pm, "AccessD on behalf of Darren - Active Billing" <accessd-bounces at databaseadvisors.com on behalf of darren at activebilling.com.au> wrote:

    
    Ahhh - OK - So it's kind of transacting - OK Many thanks - I will go and confirm the API Key values
    
    Just goes to show hee how little I know of this stuff. I assumed the request hadn't even been parsed. Let alone this error being a respons (Albeit an unwanted one)
     
    Many thanks Stuart.
    
    Darren. 
     
    
    On 15/7/19, 1:33 pm, "AccessD on behalf of Stuart McLachlan" <accessd-bounces at databaseadvisors.com on behalf of stuart at lexacorp.com.pg> wrote:
    
        That message means that you are not getting a response bac from the URL.
        
        (URL = Uniform RESOURCE locator)
        
        Without knowing a lot more about  hooks.workast.app/Do7DOEFPZDzAS20cvtt6E, I can't tell 
        why it is not working.
        
        
        On 15 Jul 2019 at 12:17, Darren - Active Billing wrote:
        
        > Hi Stuart,
        > 
        > Sorry to harass - Just wondering if I could chase you on this one
        > below - Many thanks in advance
        > 
        > Darren. 
        > 
        > 
        > 
        > On 13/7/19, 3:57 am, "AccessD on behalf of Darren - Active Billing"
        > <accessd-bounces at databaseadvisors.com on behalf of
        > darren at activebilling.com.au> wrote:
        > 
        >     Stuart,
        > 
        >     Thank you so much for replying. Sadly... no joy.
        > 
        >     Also - realise I have no clue what I am doing here. So I may have
        >     stuffed something.
        > 
        >     I get an error on the line "myXMLHTTP.send strPostData" 
        > 
        >      Error = "Run-time error '-2146697211 (800c0005)': "The System
        >      Cannot Locate the resource specified"
        > 
        >     All I have done since getting your cool code below is, reference
        >     MSXML6 and Place my URL in the line you had at:
        > 
        >      myXMLHTTP.Open "POST", "http://www.example.com/addtask.php",
        >      False
        > 
        >     with
        > 
        >      myXMLHTTP.Open "POST",
        >      "https://hooks.workast.app/Do7DOEFPZDzAS20cvtt6E", False
        > 
        >     Do you have any suggestions?
        > 
        >     Many thanks in advance.
        > 
        >     Darren. 
        > 
        >     ------------------------------------------------------------------
        >     ---------
        > 
        >     On 12/7/19, 12:56 pm, "AccessD on behalf of Stuart McLachlan"
        >     <accessd-bounces at databaseadvisors.com on behalf of
        >     stuart at lexacorp.com.pg> wrote:
        > 
        >         ---- Code HTTP POST-------------
        > 
        >         Option Compare Database
        >         Option Explicit
        > 
        >         Function GetDBDump()
        >         'Requires a reference to Microsoft XML 2.0 or greater
        >         'I've use Microsoft XML 6.0 in Office 10.
        > 
        >         Dim myXMLHTTP As XMLHTTP60
        >         Set myXMLHTTP = New XMLHTTP60
        >         Dim strResult As String
        >         Dim strPostData as String
        >         strPostData = URLEncode("text=This is  theTask Name for Task
        >         No: 4&description=This is the Description for Task No:
        >         4&dueDate:'2019-10-07'") myXMLHTTP.Open "POST", _
        >             "http://www.example.com/addtask.php", False
        >         myXMLHTTP.setRequestHeader "User-Agent", "Mozilla/4.0
        >         (compatible; MSIE 6.0; Windows NT 5.0)"
        >         myXMLHTTP.setRequestHeader "Content-type",
        >         "application/x-www-form-urlencoded" myXMLHTTP.send strPostData
        >         strResult = myXMLHTTP.responsetext debug.print strResult Set
        >         myXMLHTTP = Nothing End Function
        > 
        > 
        >         --------------END HTTP POST
        >         -------------------------------------
        > 
        >         -------------URL ENCODE/DECODE
        >         ---------------------------------
        > 
        >         Public Function URLEncode(StringToEncode As String, Optional _
        >            UsePlusRatherThanHexForSpace As Boolean = False) As String
        > 
        >         Dim TempAns As String
        >         Dim CurChr As Integer
        >         CurChr = 1
        >         Do Until CurChr - 1 = Len(StringToEncode)
        >           Select Case Asc(Mid(StringToEncode, CurChr, 1))
        >             Case 48 To 57, 65 To 90, 97 To 122
        >               TempAns = TempAns & Mid(StringToEncode, CurChr, 1)
        >             Case 32
        >               If UsePlusRatherThanHexForSpace = True Then
        >                 TempAns = TempAns & "+"
        >               Else
        >                 TempAns = TempAns & "%" & Hex(32)
        >               End If
        >            Case Else
        >                  TempAns = TempAns & "%" & _
        >                       Format(Hex(Asc(Mid(StringToEncode, _
        >                       CurChr, 1))), "00")
        >         End Select
        > 
        >           CurChr = CurChr + 1
        >         Loop
        > 
        >         URLEncode = TempAns
        >         End Function
        > 
        > 
        >         Public Function URLDecode(StringToDecode As String) As String
        > 
        >         Dim TempAns As String
        >         Dim CurChr As Integer
        > 
        >         CurChr = 1
        > 
        >         Do Until CurChr - 1 = Len(StringToDecode)
        >           Select Case Mid(StringToDecode, CurChr, 1)
        >             Case "+"
        >               TempAns = TempAns & " "
        >             Case "%"
        >               TempAns = TempAns & Chr(Val("&h" & _
        >                  Mid(StringToDecode, CurChr + 1, 2)))
        >                CurChr = CurChr + 2
        >             Case Else
        >               TempAns = TempAns & Mid(StringToDecode, CurChr, 1)
        >           End Select
        > 
        >         CurChr = CurChr + 1
        >         Loop
        > 
        >         URLDecode = TempAns
        >         End Function
        > 
        > 
        > 
        > 
        > 
        >     -- 
        >     AccessD mailing list
        >     AccessD at databaseadvisors.com
        >     http://databaseadvisors.com/mailman/listinfo/accessd
        >     Website: http://www.databaseadvisors.com
        > 
        > 
        > 
        > 
        > -- 
        > AccessD mailing list
        > AccessD at databaseadvisors.com
        > http://databaseadvisors.com/mailman/listinfo/accessd
        > Website: http://www.databaseadvisors.com
        
        
        
        -- 
        AccessD mailing list
        AccessD at databaseadvisors.com
        http://databaseadvisors.com/mailman/listinfo/accessd
        Website: http://www.databaseadvisors.com
        
    
    
    
    -- 
    AccessD mailing list
    AccessD at databaseadvisors.com
    http://databaseadvisors.com/mailman/listinfo/accessd
    Website: http://www.databaseadvisors.com
    





More information about the AccessD mailing list