Results 1 to 8 of 8
  1. #1
    irade92 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    5

    REST api POST method

    hi
    I am trying to "POST" data to a server but with no result
    Here is my code

    Private Sub POST_PRIMER()
    Dim XMLHTTP
    Dim Rezult As String
    Dim ArgumentString
    ArgumentString = "prescription_code=oz10763&exemp_from_participatio n=false&pharmacist_facsimile=913189&drug_fund_code =965421"
    Set XMLHTTP = CreateObject("msxml2.xmlhttp.6.0")
    XMLHTTP.Open "post", "https://api.zdravstvo.gov.mk/rest/prescriptions/realize", False


    XMLHTTP.setRequestHeader "Content-Type", "application/xml"
    XMLHTTP.send ArgumentString
    result = XMLHTTP.responseText
    Set XMLHTTP = Nothing
    End Sub

    where I am making mistake? Please help


    Thanks

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Dim Rezult As String
    Spelling error

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Unless Option Explicit is declared, spelling should not be an issue, and if declared the compiler should bug on the unDimmed 'result'. The code doesn't do anything with result or Rezult.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    API is an application interface, your application and their interface. I would start with combing through the server’s interface parameters for your POST command. They develop the API and you need to follow their (the server’s rules). I would double check the XML version they accept. They may not be set up for MS6.0. Double check your argument and make sure all characters are in order. Also, the .setRequestHeader seems more relative to a GET command than a POST command.

    Once you match the correct MSXML version, make sure you have it installed on your OS and referenced in Access. Those are the questions I have after reading your post.

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Read your PM, but I really don't understand what you are trying to accomplish; plus I have never tried writing to a server the way you are attempting to.

    Why aren't you using ODBC to conned to the server and write the data?
    What server are you connecting to?

  6. #6
    irade92 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    5
    ????????????????????

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Just ran your code, you get this response
    Code:
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>403 Forbidden</title>
    </head><body>
    <h1>Forbidden</h1>
    <p>You don't have permission to access /rest/prescriptions/realize
    on this server.</p>
    <hr>
    <address>Apache/2.2.22 (Debian) Server at api.zdravstvo.gov.mk Port 443</address>
    </body></html>
    The code runs from my PC once I corrected the spelling error.

    It says you DO NOT HAVE PERMISSION to access the server.

    But we don't know what you are trying to accomplish. You probably need an account and password to be known to their system.
    A little background and context would be helpful to readers.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Do you have a response the questions in post 5? And to the comment in post3 that the code does nothing with variable result after it is populated with value.

    What about the spelling of Rezult and result noted in post 2?

    What is XMLHTTP? You want to post data to what application?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. My post was deleted.
    By azeotrope in forum Queries
    Replies: 2
    Last Post: 06-20-2013, 03:34 PM
  2. Replies: 14
    Last Post: 04-25-2013, 05:14 PM
  3. Replies: 5
    Last Post: 06-28-2012, 10:49 AM
  4. Help with subforms (and the rest)
    By Franco27 in forum Reports
    Replies: 0
    Last Post: 03-14-2011, 09:43 AM
  5. Combox not filling the rest of the form
    By britt britt in forum Forms
    Replies: 2
    Last Post: 10-27-2009, 04:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums