Scritping the Restful API in VBA

Hi All,
I´m trying to script calls to the Restful API using VBA . This is the code I´m using :
Private Sub CommandButton1_Click()
Set objhttp = CreateObject("MSXML2.XMLHTTP")
   URL = "http://vrt0568.bndes.net:6405/biprws/logon/long"
   objhttp.Open "POST", URL, False
   objhttp.setRequestHeader "Content-Type", "application/xml"
   objhttp.send ("userName=plank&password=Cecili@123&auth=secLDAP")
   I = 1
End Sub
The problem is that I keep receiving a 401 error (unauthorized).
Does anyone knows what I´m doing wrong ?
Thanks in advance,
Rogerio

I posted some real sample code a while back for a completely different function (member renames).
Renaming Existing Member Names
So while you'll have to write the calc modification code yourself (or ask Glenn his rate ;-)), this at least shows you how the initialization / login / termination of the API would work. That's probably the most confusing aspect of using the VB API for the first time anyway.
All that said, if this is from Excel and the user will already be logged in via the Excel Add-In, I believe that you can make life much easier and grab the hCtx directly without any initialization / login/ termination worries. I probably should have done that myself in the example I gave. See Tim Tow's posts in this thread:
API
EDIT: Two things I just noticed - first, the code sample I gave even has an example of polling for ProcState, so that gets you closer than I thought! Second, remembered that the line that reads...
While ProcState.State ESB_STATE_DONE
...should actually have a 'less than / greater than' symbol between ProcState.State and ESB_STATE_DONE. Can't get the forum to display them correctly, even in code tags...
Edited by: TimG on May 16, 2011 2:55 PM

Similar Messages

  • How to create a campaign based on a template using the REST API

    Hi CodeIt-ers,
    I'm using the REST API to create campaigns in Eloqua 10, all works well except for 1 thing: I can't seem to create a campaign based on an existing Campaign template.
    Based on the documentation on REST API - Accessing Campaigns I've tried using "sourceTemplateId" (code snippet below) but that did not do the trick.
    Does that functionality simply not work or am I missing something?
    Thanks!
    Ferry
    $campaign_data = new Campaign(); 
    $campaign_data->sourceTemplateId='442';
    $campaign_data->folderId='1137';
    $campaign_data->currentStatus='draft';

    Hi Richard,
    Unfortunately no. I reached out to support, they informed me "sourceTemplateId" could not be used to create new campaigns based on a template, instead they advised to use the "Elements " property as shown in this example: Eloqua REST API - Create a Campaign with a Segment and Email
    Thanks
    Ferry

  • How to filter the Rest Api data based on Taxanomy columns

    Hi Everyone,
    We are using SharePoint2010 Standard Edition.
    I wanted get the library details through REST Api. I am using as below:
    https://SiteUrl/_vti_bin/listdata.svc/Documents?$filter=Title eq 'SharePointDoc'
    Here I am able to get the info regarding "SharePointDoc". But when I am trying to get the details from Taxonomy filter, it didn't.
    Can anyone please tell me how can we filter based on Taxanomy fields.
    Thanks in Advance
    Krishnasandeep

    Hi,
    I understand that you wanted to filter the Rest Api data based on Taxanomy columns.
    Per my knowledge, in SharePoint 2010 , not all types of column are available via REST, most annoyingly managed metadata columns are amongst this group of unsupported column types.
    However, in SharePoint 2013, we can filter list items based on taxonomy (managed metadata) columns.
    Taxonomy fields can be now called via REST API using CAML query in REST calls.
    Here is a great blog for your reference:
    http://www.cleverworkarounds.com/2013/09/23/how-to-filter-on-a-managed-metadata-column-via-rest-in-sharepoint-2013/comment-page-1/
    You’d better to change the REST calls and the CAML query to check whether it works in SharePoint 2010.
    More information:
    http://platinumdogs.me/2013/03/14/sharepoint-adventures-with-the-rest-api-part-1/
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Using the REST API for files, how do I get information on all the folders and files in a folder?

    I have an app that can successfully get a list of a folders content. However, by default the list is limited to 200 entries. I luckily ran into this limit when getting the list on a folder that contained 226 entries and realized I needed to then request
    a list of the next items but it wasn't obvious from the REST API document how to do that. I tried sending the skipToken query parameter and setting it to 0 initially and incrementing each time I sent the request but always got the same 200 items back. So,
    how do I get the list of files and folders beyond the initial list?

    In SP2013 the skiptoken query parameter does not work with list items. You can look at the link below which discusses using the "__next" parameter.
    http://stackoverflow.com/questions/18964936/using-skip-with-the-sharepoint-2013-rest-api
    Blog | SharePoint Field Notes Dev Tools |
    SPFastDeploy | SPRemoteAPIExplorer

  • How to send a encrypted packet to the REST API Service using Fiddler or Post Man

    Hi,
    I am trying to send encrypted (AES) JSON packet to the REST API on the Azure cloud using tools like Fiddler.
    I am trying to use POST method and attaching the encrypted .aes file to the Fiddler tool.
    I am getting the 3 types of error messages.
    1) HTTP/1.1 502 Fiddler - DNS Lookup Failed
    2) HTTP/1.1 500 Internal Server Error
    3) HTTP/1.1 407 Proxy Authentication Required
    I have tried with my company network and tried with external internet connection also.
    Please help me.
    Thank you!
    Regards,
    Krishna

    Hi,
    you can create a simple rest api on the Azure cloud, and then try to use fiddler to do some test, so that we can exclude the environment issue.
    Regards

  • Enabling Profiling for deployments via the REST API

    We have an application which is being deployed via the REST API. Our logging has captured some errors related to memory consumption that we'd like to examine using profiling. All the examples of profiling in Azure that I can find discuss deployment via Visual
    Studio which is not feasible in this instance.
    Is there a way to enable profiling via the REST API and if so are there any examples or documentation for this? We're using Linq2Azure to access the APIs but we can extend it if necessary.
    Thanks
    Colin

    Hi,
    Yes, we can choose enable profiling when we publish an application via visual studio, from my experience, this feature was provided by using the Visual Studio profiler, if we didn’t use visual studio to deploy the application, it is hard to enable profiling.
    Refer to
    http://msdn.microsoft.com/en-us/library/windowsazure/hh369930.aspx#BK_ProfilingCloudService for more information.
    Best Regards

  • How to access a sharepoint site via the REST API in Python?

    I have the following site:
    http://win-5a8pp4v402g/sharepoint_test/site_1/
    When I access this from the browser, it prompts me for the username and password and then works fine. However I am trying to do the same using the REST API in Python. I am using the requests library, and this is what I have done:
    import requests
    from requests.auth import HTTPBasicAuth
    USERNAME = "Administrator"
    PASSWORD = "password"
    response = requests.get("http://win-5a8pp4v402g/", auth=HTTPBasicAuth(USERNAME, PASSWORD))
    print response.status_code
    However I get a 401. I dont understand. What am I missing?

    Try adding the auhenticatig domain to the username.  That may help.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Are these functions available in the REST API?

    I searched the documentation, but have found no way to do the following:
    Perform a CMS Query (or any other way to filter/retrieve CMS objects)
    Get current user's info (Favorites folder ID, Inbox ID, etc.)
    Get security details for objects
    Get info on Events, Calendars, Servers

    Pardon me for saying so, but if you valued my support you would make the transition easier.  As I mentioned in my other thread, wrapper classes would be a good start.
    As it is, I'm not only stuck having to re-code all my applications and scripts, but re-build them from the ground up.  And that's if the functionality exists -- if not, I then have to make calls to two wholly different APIs in the same script.  And, contrary to what I've read here, using the REST API requires a lot more supporting code, is less reusable, and pushes errors from compile-time to run-time.
    "Cumbersome" is not a word I would use.
    While it may be easier to be enthusiastic at the potential for developing on a platform that was previously unavailable, it's much harder when I have to put time and effort into redeveloping into something that will net me little benefit. 
    Why not continue to maintain the Java and .NET SDKs until the REST API has implemented all of their functionality?

  • Does the REST API offer team member capacity?

    I would like to get the capacity for all team members in a project for a sprint. The documentation does not say this is available but it may just not be documented. If its possible, which endpoint would expose this information?

    Hi lgoolsby,
    According to Visual Studio Online REST API reference on this
    page, there is no capacity for team members of a team project. You can submit a user voice
    here to request or confirm the reference.
    However, you can view team members' capacity on team web access directly. Thanks for your understanding.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Get the item level permission in sharepoint 2013 uisng rest api

    I created the test list  and i created the 5 items in that list.
    I stopped the item level permissions.
    I shared the list item with userA.
    In the rest api response, it giving the other users also (means user who is not having permission to the item).
    I am using below rest query
    /_api/Web/GetFileByServerRelativeUrl('/site/Lists/test/1_.000')?$expand=Versions,Author,ModifiedBy,ListItemAllFields/RoleAssignments/Member/Users,ListItemAllFields/FieldValuesAsText,ListItemAllFields/ParentList

    Hi,
    Following are the steps, I performed:
    After adding the item in the list, I went into list item permissions and clicked on stop item permissions. Then I selected all the permissions which got carried over to the item and clicked on "Remove user permissions" in the ribbon. After that
    I clicked on Grant permissions in the ribbon and shared the item with one user. Note that last action can also be performed by going back into the list and selecting the item and click on Share.
    Finally, I ran the above REST query and returned the user with whom the item was selected and also the system account (which is expected, as admin will have access.
    You can try shortening your query as well
     /_api/Web/GetFileByServerRelativeUrl('/site/Lists/test/1_.000')?$expand=ListItemAllFields/RoleAssignments/Member/Users
    This will return the relevant user permissions and response will contain lesser data and hence will be easier to read. Lastly, try intercepting the traffic
    using fiddler, as again it will in reading the response.
    Thanks,
    Nadeem
    Please remember to up-vote or mark the reply as answer if you find it helpful.

  • How to fetch all the contact fields using Office365 REST API

    When I request for Contacts using webservices URL, Office365 returns only some specific fields (even though contact record has lot more fields). Is there any way so that I can fetch all the fields in contact record?

    Currently the REST APIs are limited to the fields you see now. We're constantly working to add more features though, so that might come in the future.

  • What Are The Minimum Permissions In Order An User To Be Able To Access User Profile Data With JavaScript And REST API

    The question says it all:
    What Are The Minimum Permissions In Order An User To Be Able To Access User Profile Data With JavaScript And REST API.?
    In the User Profile -> Permissions there is only the option for "Full Control".

    Hi Nikolay,
    Thanks for posting your issue, you need to set permissions on User Profiles = Read. Kindly find the below mentioned URLs to get the code and more details on this.
    http://www.vrdmn.com/2013/02/sharepoint-2013-working-with-user.html
    http://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html
    http://sharepoint.stackexchange.com/questions/61714/sharepoint-2013-call-the-rest-api-from-sharepoint-hosted-app
    http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2013/04/09/how-to-query-sharepoint-2013-using-rest-and-javascript.aspx
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • Office 365 Files REST API - Get direct children in the root of the default document library

    I'm trying to work with Office 365 Files REST API which works just fine except one thing that I'm struggling with.
    What I need for my application is to make an explorer like browse capability for OneDrive for business Document Library.
    My problem is that I don't know how to get the direct children in the root of the Document library
    The API request
    GET ../_api/files will
    retrieve all files and folders in the default document library, including files and folders from sub-directories.
    What I need is basically the functionality of the API request
    GET ../_api/files(<folder_path>)/Children
    that works also for the root folder of the Document library. The problem is that I couldn't find a way set <folder_path> as the root folder. 
    I found out that the API call ../_api/web/getfolderbyserverrelativeurl(<folder_server_relative_path>)/Folders and _api/web/getfolderbyserverrelativeurl(<folder_server_relative_path>)/Files works as expected resulting the only the direct
    children of the root folder if the folder_server_relative_path is the path of the document library. The problem with this API call is that it's requires server relative path of the (default) document library (which i don't have) and the result has a different
    schema compared to the ../_api/files REST API call.
    Can somebody help me with this problem?
    David

    First thanks for the fast answer. Let me explain my use case in more details.
    I'm trying to work with the new summer release of the
    Office 365 API tool for Visual Studio 2013 (update 3)
    I found no reasonable way to retrieve the direct children of the root folder from my One Drive for business Document Library using the newly added SharePointClient library.
    The API call of `SharePointClient.Files` will retrieve all the files and folders from the whole document library including sub-folders. So in order to get only the direct children I have to page through all the documents and folders and analyze their URL, which
    is not acceptable for my application scenario. For a sub-folder I can get the direct children like this: `SharePointClient.Files["<folder_id>"].ToFolder().Children` This is what I need but it can't be applied to the root folder.
    So what I did I've checked what REST API calls this library makes and I've tried to find out if there is a way to achieve my goal at least using direct REST API call. It seems like the functionality is missing from the REST API itself. 
    The http://site
    url/_api/web/lists/GetByTitle(‘libraryname’)/items API call also retrieves all the items hierarchy from the library (including items from sub-folders) and the result XML "schema" (fields and the meaning of the ID) differs from the one used
    by the calls by SharePointClient library. (for example the "Id" is a number when the /items is called but when
    /_api/files is called the "Id" is the relative path to the document library)
    Basically what I need can be achieved with the call to http://site url/_api/web/lists/GetByTitle(‘libraryname’)/rootfolder/files and http://site
    url/_api/web/lists/GetByTitle(‘libraryname’)/rootfolder/folders but again the schema of the result differs from the one used in SharePointClient
    library. This means that in order to get  the direct children of the root I will need to re-implement a good part of the SharePointClient library. It seams like there is 2 kind of REST API is implemented. ( missing  "Id" and "url"
    fields, etc)
    Also there is no convenient way to get the Name or the GUID of the default document library which the SharePointClient.Files
    (https://site_url/_api/file) automatically
    uses. The DiscoveryContext.DiscoverCapability for "MyFiles" doesn't gives any hint either.
    David

  • Is "2013-08" the latest REST API version or is the documentation outdated?

    I'm wondering if the Azure Notification Hubs REST API documentation is
    still correct and up-to-date or if there is already a newer API version than "2013-08" that can be used.
    All the single pages show "Updated: February 26, 2015", but I guess it was just a meta data update of all the pages, since the API version didn't change,
    it's still "2013-08". Is this intentional because the API didn't change or was it forgotten to update the API version?
    Here (and here)
    is an example for the REST API usage from Elio Damaggio which uses "2013-10" as the api version. I tried all possible api version values in the format "yyyy-mm" from "2013-10" to "2015-03" and the following
    were working: "2013-10", "2014-01", "2014-05", "2014-08", "2014-09", "2015-01". Are there actual changes to the API and if so, aren't they officially supported or what is the reason for the
    old API version in the documentation? 
    Is the API version "2015-01" officially supported and can I find the documentation for it or am I stuck with API version "2013-08"? Or
    aren't there any changes worth updating the documentation?
    Moreover the documentation for "Read All Registrations of a Channel" states to use
    following request URI, which doesn't work: https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/?$filter=DeviceToken eq ‘{deviceToken}’&api-version=2013-08
    Even more confusing, the german version uses double quotes, which doesn't work either: https://{Namespace}.servicebus.windows.net/{Benachrichtigungshub}/registrations/?$filter=DeviceToken
    eq "{Gerätetoken}"&api-version=2013-08
    I found out that the correct request URI must be like this to work: https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/?$filter=DeviceToken+eq+'{deviceToken}'&api-version=2013-08 ,
    so + instead of spaces and '' (apostrophe / straight single quote - U+0027) instead of ‘’ (single curved quotation marks - U+2018 and U+2019) or "" (straight double quote - U+0022), e.g. https://myServiceBusNamespace.servicebus.windows.net/myHub/registrations/?$filter=DeviceToken+eq+'2ED202AC08EA9033665E853A3DC8BC4C5E78F7A6CF8D55910DF230567037DCC4'&api-version=2013-08
    Is the documentation just wrong by mistake or is it not up-to-date? How are people even using the REST API without a 100% correct documentation? Is
    there something I am missing? Do you get a manual when you buy a Azure Notification Hubs subscription or is the REST API not even supported officially?

    The latest version is 2015-01. All or most of features works with starting version 2013-08.
    Version in documentation indicates that minimum version required for working that feature. Hence, all documentation is pointing to 2013-08.
    You should do the URL encoding before making http request. Otherwise special characters such as blanks and punctuation are passed in an HTTP stream without encoding, they might be misinterpreted. Hence your request failed due to space. You can use the following
    method to do the URL encoding.
    https://msdn.microsoft.com/en-us/library/4fkewx0t%28v=vs.110%29.aspx
    Yes, REST API is fully supported. May be there could be few gaps or bugs. We are putting constant efforts to fix all bugs as we find and improve it further.
    Thanks,
    Sateesh
    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

  • REST API StartUpload method - "The method or operation is not implemented"

    Hi,
    I've been looking at using the following to upload large files to SharePoint Online/OneDrive for Business.
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx#bk_FileStartUpload
    According to the documentation "This method is currently available only on Office 365."
    When I try to use the StartUpload Method I get the following exception returned
    {"error":{"code":"-1, System.NotImplementedException","message":{"lang":"en-US","value":"The
    method or operation is not implemented."}}}
    What I want to do is be able to upload large files to SharePoint online using a console application and the REST API.
    At the moment I can upload a 512mb using the below, the problem I get with this is I don't get a response from the API. I get a timeout exception after 2 hours only when get a response on this line WebResponse response = request.GetResponse()
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx#bk_FileCollectionAdd
    Any help or pointers would be much appreciated. I've posted on a number of forums and had no success. Thanks

    Hi,
    We can do as follows:
    1. If you have a large list, please look at the links below:
    http://blogs.technet.com/b/speschka/archive/2009/11/13/large-list-throttling-for-external-lists-in-sharepoint-2010.aspx
    http://akanoongo.blogspot.com/2011/02/how-to-resolve-2000-items-resolution-in.html
    2. Also please check the steps about create an external list.
    http://msdn.microsoft.com/en-us/library/office/ee558778(v=office.14).aspx
    3. Create a new Table in Database and create a new external list to check whether the issue still exists.
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

Maybe you are looking for

  • HP Color Laserjet 2550N problem with letter size documents

    If user sends a Letter size print job to the printer loaded with A4 paper printer fails to print until we hit the continue button even if the "Auto Continue" feature is selected. This feature is important because even if A4 is the standard paper size

  • In PO , while giving one plant GRWR is not getting defaulted

    Hi, While creating a purchase order, in Conditions tab the GRWR is getting defaulted if I am giving one plant but it i snot getting defaulted if I am giving some other plant. Why? What could be the reason. Rgds Arpit

  • Call on update module without addition "in update task"

    Hi, folks! Could anyone please explain the behaviour of an update module that is called without addition "in update task" with regards to transactionality and locking? Where is the processing carried out - in the dialog step, I guess? Does a COMMIT W

  • Satellite P100-160 - Keyboard fault

    I have a Satellite P100-160 which was working fine but has gradually become unreliable. Initially I blamed PKZIP v9 since it was the last thing installed before the system started to go downhill so I uninstalled it. But alas it was not to blame. It l

  • Some hard drive guidance please?

    Hi, I use FCE4 with my macbook pro. I've used an OWC external hard drive for a few years, and love it, but it's starting to die. And I need to replace it. here are the specs I'm looking for. * At least 300 gig * 7200 rotational speed * Firewire 800 *