RESTFul URI parameter limitations/bugs

Hi,
I've run into some limitations (or bugs, don't know which is the most appropriate term at this point) regarding URI template parameters for RESTful Services. Here are a few examples to illustrate:
First limitation:
To start with, I define the following Resource Template: *example?p1={p1}&p2={p2}*
I use the following query as the GET handler: select :p1, :p2 from dual
This works fine, the URL example?p1=foo&p2=bar gets a json response like this: {":1": "foo",":2": "bar"}
I then create a second Resource Template with only the first parameter from the previous template: *example?p1={p1}*
I use the following query as the GET handler: select :p1 from dual
This works as expected, however now the previous template returns the following: {":1": "foo&p2=bar"}, i.e. the part of the URI string after p1= gets parsed as a single parameter.
Second limitation:
I define the following resource template: *example1/{p1}*
I use the following query as the GET handler: select :p1 from dual
Works fine.
I then define the following resource template: *example1/{p1}/example2*
I use the same query again as the GET handler: select :p1 from dual. This time the whole part of the URI string from {p1} forward gets parsed as the p1 parameter, which means it returns {":1":"foo/example2"} rather than {":1":"foo"}. However, if I remove the example1/{p1} template, the example1/{p1}/example2 works as expected.
In both cases, it seems like the rules for URI templates are excessively strict regarding URI similarities with other templates. I've been unable to find any reference to this in the documentation, other than a vague reference to a lack of support for "optional parameters".
Assuming these are known limitations rather than bugs, might they be removed in a future release?
Versions:
APEX Listener 2.0.1
WLS 10.3.6 on Windows 2008 R2 (64-bit)
Oracle DB 11.2.0.3
APEX 4.2.1
Thanks,
Tobias

TobiasE wrote:
Hi,
I've run into some limitations (or bugs, don't know which is the most appropriate term at this point) regarding URI template parameters for RESTful Services. Here are a few examples to illustrate:
First limitation:
To start with, I define the following Resource Template: *example?p1={p1}&p2={p2}*
I use the following query as the GET handler: select :p1, :p2 from dual
This works fine, the URI example?p1=foo&p2=bar gets a json response like this: {":1": "foo",":2": "bar"}
I then create a second Resource Template with only the first parameter from the previous template: *example?p1={p1}*
I use the following query as the GET handler: select :p1 from dual
This works as expected, however now the previous template returns the following: {":1": "foo&p2=bar"}, i.e. the part of the URI string after p1= gets parsed as a single parameter.
This is when you need to use the priority value to help the listener choose the most appropriate URI Template. Hopefully I can explain what is actually happening and make this a bit clearer.
The important thing to realise is that a URI Template matches any characters, characters which you might assume are significant to the matching algorithm, the characters which act as delimiters in the URI and query string syntax are not treated as delimiters, they have no special significance, *&*,*=*,*/*,*?* are all treated just the same as any other character . If you look at the final URI Template RFC [1] you can get a feel for how involved it gets trying to specify a URI Template syntax that can robustly match against all common URI patterns, and actually describe a syntax that is aware of the significance of these delimiters.
So it's your second Resource Template that is matching both URIs and the first one is not getting invoked at all.
*example?p1={p1}&p2={p2}* matches example?p1=foo&p2=bar, i.e. *{p1}* is mapped to foo and *{p2}* is mapped to bar
*example?p1={p1}* matches both example?p1=foo and example?p1=foo&p2=bar, i.e. in the first case *{p1}* is mapped to foo and in the second case *{p1}* is matched to: foo&p2=bar
In plain english the second template means ' match *{p1}* against any text occuring after: example?p1= '
So when faced with trying to find the appropriate resource template for the URI, listener finds two matching resource templates, which one does it choose?
The answer is it chooses the one with the highest priority, but if they are both the same priority, then (and admittedly this isn't documented anywhere, it may be subject to change in future releases) it chooses the resource template that requires the least number of parameters to achieve a match (this is just a basic heuristic to help make a choice, it's a bit of a coin toss whether it matches what the developer might have intended).
So the solution is to give the Resource Templates different priorities, it's up to you to figure out the order in which you want listener to match your templates that match a given URI. Give the template you want checked first the highest priority, the template you want checked second a lower priority.
So to fix this problem give *example?p1={p1}&p2={p2}* priority of 9 (or any value > the default of 0) and that should solve the problem
Second limitation:
I define the following resource template: *example1/{p1}*
I use the following query as the GET handler: select :p1 from dual
Works fine.
I then define the following resource template: *example1/{p1}/example2*
I use the same query again as the GET handler: select :p1 from dual. This time the whole part of the URI string from {p1} forward gets parsed as the p1 parameter, which means it returns {":1":"foo/example2"} rather than {":1":"foo"}. However, if I remove the example1/{p1} template, the example1/{p1}/example2 works as expected.
This is the same issue again really, change the priority of *example1/{p1}/example2* to be greater than the priority of *example1/{p1}*.
In both cases, it seems like the rules for URI templates are excessively strict regarding URI similarities with other templates. I've been unable to find any reference to this in the documentation, other than a vague reference to a lack of support for "optional parameters".
Assuming these are known limitations rather than bugs, might they be removed in a future release?
So as you can see these are known limitations, rather than bugs.
Without committing to anything, I would certainly like to support more of the final URI Template RFC, but as you can see if you read it, there is a fair bit of complexity involved in doing so. A large part of the problem is that URI Templates were really envisaged for the inverse of how we use them (and how other server side frameworks like RESTlet and .NET use them). URI Templates as specified are primarily intended to be used on the client side to form request URIs from a URI Template and parameter values. We're using them the other way round, trying to decode request URIs to match against templates and thereby extract parameter values (to pass into our queries).
For now I'm not in a hurry to add more support, until we see compelling cases where the above prioritization mechanism cannot solve the matching problem, so would be glad to hear back from you if find scenarios that are not supportable at the moment.
Regards,
Colm
[1] http://tools.ietf.org/html/rfc6570

Similar Messages

  • Problem with passing variable to restful uri's.

    I have a restful URI in the format http://localhost/functionname/{itemID}. I use this URI to retrieve JSON formatted information. Through Flash Builder 4 data services I create an operation that makes use of this URI and I also hame itemID a URL parameter. The problem is that whenever I call this function from my program Flex uses the following URI instead " http://localhost/functionname/%7BitemID%7C" in other words it doesnt replace the "{itemID}" with my variable. I am using SDK 3.4 to compile. Is this a known bug and if yes how can I circumvent it? Please notice that the project needs to compile using SDK 3.4 no matter what. Thank you for reading.

    Depending on how you set it up, it isn't clear that the compiler will see
    as a binding expression.  What does your code look like that sets
    it up?

  • Consuming SharePoint REST URI in ORACLE ERP

    Hi all,
    Does ORACLE ERP support SharePoint Rest end points to access data?  to bring ORACLE ERP data into SharePoint, we would use BCS but what are my options if it is other way around?
    Thanks in advance.

    Hi,
    Yes, you can use Rest API to bring Oracle ERP data into SharePoint.
    The Rest web service use HTTP commands to post data with the Rest URI and response data with json format.
    It allows client access the SharePoint Object which supports Rest Web requests.
    More information about Rest API:
    http://msdn.microsoft.com/en-us/library/office/fp142380(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/jj860569(v=office.15).aspx
    Best regards,
    Zhengyu Guo
    Zhengyu Guo
    TechNet Community Support

  • RESTful web services : Accessing the param id resource URI parameter.

    Hello all,
    I created restful web services using Netbeans 6.1--->New RESTful web services from patterns-->Container-Item.
    This gives me 2 class files, for example : MyWSsResource and MyWSResource.
    Now in MyWSResource there are 3 generated methods GET, PUT and Delete.
    Here is an example of the GET
    @Path("/myws/{arg1}")
        @GET
        @ProduceMime("application/xml")
        public String getXml(@PathParam("id")
        String id) {
            if(context.equals(null)) {
            throw new UnsupportedOperationException();
           //My code below
            FpkSentDB fpkSent = new FpkSentDB();
            MultivaluedMap<String, String> params = context.getTemplateParameters();
            String arg1       = params.getFirst("arg1");
            return fpkSent.getFPKSent(arg1).toString();
    {code}I am not understanding the following code:
      {code:java} (@PathParam("id") String id) {code}
    .... I can access arg1 using the URI/arg1value.
    How is PathParam("id")  meant to be accessed?
    If I do a {code:java} logger.debug("ID equals:" + id);{code}
    id returns null always.
    My code works just fine as it is but I am new to REST and wanted to follow spec as closely as possible.
    Any Ideas?
    TIA!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Any possible solution for the issue?, so much thanks for it.

  • Exclude parameter limitations

    Hi
    is there any limitations for excluding no of objects while doing expdp
    when i m excluding 2 table is running
    expdp system/**** parfile=q.par
    ________________________________ q.par__________________________________________________________________________
    DIRECTORY=TEST_DIR DUMPFILE=filename.dmp LOGFILE=filename.log SCHEMAS=xyz exclude=TABLE:"IN ('tab1', 'tab2')"
    when i m excluding 2000 tables expdp is showing below error
    Export: Release 11.1.0.6.0 - 64bit Production on Tuesday, 28 September, 2010 17:08:44
    Copyright (c) 2003, 2007, Oracle. All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    UDE-00014: invalid value for parameter, 'exclude'.
    plz suggest.

    Use a parfile, it should work without issue.
    # expdp sysadm/*** dumpfile=test.dmp schemas=sysadm exclude=table:"in (select table_name from my_tables_to_exclude)"
    Export: Release 10.2.0.4.0 - 64bit Production on Wednesday, 29 September, 2010 9:23:07
    Copyright (c) 2003, 2007, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP, Data Mining
    and Real Application Testing options
    ORA-39001: invalid argument value
    ORA-39071: Value for EXCLUDE is badly formed.
    ORA-00936: missing expression
    # more param.par
    dumpfile=test.dmp
    schemas=sysadm
    exclude=table:"in (select table_name from my_tables_to_exclude)"
    # expdp sysadm/*** parfile=param.par
    Export: Release 10.2.0.4.0 - 64bit Production on Wednesday, 29 September, 2010 9:23:24
    Copyright (c) 2003, 2007, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP, Data Mining
    and Real Application Testing options
    Starting "SYSADM"."SYS_EXPORT_SCHEMA_02":  sysadm/******** parfile=param.par
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    ...Nicolas.

  • Can we upload any Content Assets using Rest API or Limited?

    Hi,
    Wanted to understand... based on Component Library, what type of Assets/Content we can upload in Eloqua (E10) before we plan for resources. (images, Hyperlinks, Field Merge, Shared Content, Dynamic Content, Signature Layout, Signature Rule)?
    I understand Email Headers and Footers are already included.
    Thank You
    Amit Pandya

    Hi rkrawat it would appear that you can only access images via the REST API using E10. See this chart for more info Eloqua API Chart

  • Dynamic Page Parameter Limitations

    Parameters (bind variables) do not seem to be equivalent to string literals when passed to other procedures.
    Try this:
    1)create dynamic page
    2)make the contents call a known function [oracle]begin htp.print(portal30.wwsec_api.id('portal30')); end;[oracle]
    3)run successfully
    Now try this:
    1) change the literal 'portal30' to a dynamic param (:usr)
    2) run from the customize link entering portal30 for usr
    3) unsuccessful
    Why isn't the bind variable style parameter equivalent to a string literal when it is forwarded?

    Could someone see if this works for them - it takes just a moment. I'm really perplexed. When I pass the bind variable to dbms output, it looks right.

  • XDK for java oracg.bat parameter problem/bug

    I have been having problems with generating java classes from my
    dtd when I noticed the following:
    @echo off
    set xdkparm=
    :loop
    if "%1"=="" goto end
    set xdkparm=%xdkparm% %1
    shift
    goto loop
    :end
    java oracle.xml.classgen.oracg %xdkparam%
    As you can see, the xdkparam var is used to invoke the classgen,
    whereas xdkparm var is used to collect the parameters...
    I changed the latter xdkparam to xdkparm, which lead to a
    different problem, but I think I am getting close.

    It is bug(#2157496) and will be fixed by next release.

  • NX 2224 Etherchannel issues - 2224 limits - Bug or myself

    Hi all,
    does anybody know if there is a kind of limitation to deploy Etherchannel on 2224 FEX (VPC or Not, Mode on or LACP)
    In fact i tried to setup a channel on a 2224 and ports came in err disable mode with a reason set to null
    When i apply the same config to a 2248 (same fex N°, same ports, same devices at the other end), it works perfectely
    thanks for your help
    regards

    Hi,
    i just looked and there is a known defect:
    http://tools.cisco.com/Support/BugToolKit/search/getBugDetails.do?method=fetchBugDetails&bugId=CSCtl68802
    please check if that applies to your scenario aswell.
    thanks...
    Matthias

  • Major EJB scalability limitation/bug

    We have a system that uses WebLogic 4.5 for JSP and container-managed EJB
    and started seeing really bad performance degradation under any sort of load
    test. After a couple of days of debugging, I found that method calls on EJB
    objects would get slower at a rate that was worse than proportionate to
    the number of beans in the system. Calling a read-only method
    ("getUserName()") on a bean ("UserBean") would take around .2ms when there
    is only one UserBean in the cache, around 2.5ms when there are 100 beans in
    the cache, and around 100ms when there are 2000 beans in the cache.
    After some poking around, I found that virtually all (96%) of the time was
    going into the LRUCache manager, which has a lot of unnecessary debugging
    code that recreates the entire cache hashtable on every method call. This
    results in a huge number of allocations and inserts, and renders the system
    basically unusable at any real user load.
    Has anyone else seen this kind of performance degradation under WL4.5?
    Anyone have a fix/workaround?

    See the thread:
    news://www4.weblogic.com/<7ru0hr$ell$[email protected]>
    mbg
    David Engberg wrote:
    We have a system that uses WebLogic 4.5 for JSP and container-managed EJB
    and started seeing really bad performance degradation under any sort of load
    test. After a couple of days of debugging, I found that method calls on EJB
    objects would get slower at a rate that was worse than proportionate to
    the number of beans in the system. Calling a read-only method
    ("getUserName()") on a bean ("UserBean") would take around .2ms when there
    is only one UserBean in the cache, around 2.5ms when there are 100 beans in
    the cache, and around 100ms when there are 2000 beans in the cache.
    After some poking around, I found that virtually all (96%) of the time was
    going into the LRUCache manager, which has a lot of unnecessary debugging
    code that recreates the entire cache hashtable on every method call. This
    results in a huge number of allocations and inserts, and renders the system
    basically unusable at any real user load.
    Has anyone else seen this kind of performance degradation under WL4.5?
    Anyone have a fix/workaround?--
    =====================================================
    Reply to the newsgroup. Don't reply to this mail
    alias. This is used only for answering posts on
    WebLogic Newsgroups.
    =====================================================

  • RESTFUL WebSevice in APEX 4.0, how to do

    I have setup a restful webservice using NetBeans and Glassfish.
    I can access the webservice using browser with this address: http://testserver1:8081/SampleDB/resources/emps
    and it gives me reply:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <emps uri="http://testserver1:8081/SampleDB/resources/emps">
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7839/">
    <dept uri="http://testserver1:8081/SampleDB/resources/emps/7839/dept/" />
    <empCollection uri="http://testserver1:8081/SampleDB/resources/emps/7839/empCollection/">
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7839/empCollection/7698/" />
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7839/empCollection/7782/" />
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7839/empCollection/7566/" />
    </empCollection>
    <empno>7839</empno>
    <ename>KING</ename>
    <hiredate>1981-11-17T00:00:00+08:00</hiredate>
    <job>PRESIDENT</job>
    <sal>5000</sal>
    </emp>
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7698/">
    <dept uri="http://testserver1:8081/SampleDB/resources/emps/7698/dept/" />
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7698/emp/" />
    <empCollection uri="http://testserver1:8081/SampleDB/resources/emps/7698/empCollection/">
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7698/empCollection/7499/" />
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7698/empCollection/7521/" />
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7698/empCollection/7654/" />
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7698/empCollection/7844/" />
    <emp uri="http://testserver1:8081/SampleDB/resources/emps/7698/empCollection/7900/" />
    </empCollection>
    <empno>7698</empno>
    <ename>BLAKE</ename>
    <hiredate>1981-05-01T00:00:00+08:00</hiredate>
    <job>MANAGER</job>
    <sal>2850</sal>
    </emp>
    </emps>
    I can also query the webservice with following: http://testserver1:8081/SampleDB/resources/emps/7839 then it will gave me only the reply for record with empno = 7839.
    I tried to setup in APEX 4.0 to get the data from this webservice with following step:
    - Under Shared Component, create Web Service References with following setting:
    Name: Test Sample DB
    URL: http://testserver1:8081/SampleDB/resources/emps
    HTTP Method: Get
    Output format: XML
    Response XPath: /Result
    Resoponse Namespace: url
    REST Input Parameter: None
    REST Output Parameter: None
    REST HTTP Headers: None
    - Then I test the webservice and it give the response as I have it in the browser.
    - Then I tried to create new page with type "Resport on Web Service Result" in the application with following setting: Web Reference Type: REST, Werb Service Reference: Test Sample DB but I can not continue because I do not know what to enter when I need to supply the Temporary Result Set Name (Collection).
    Any helps are appreciated.

    Itobinh:
    Firstly I apologize that I haven't seen this post sooner, and that you are having trouble with consuming a RESTful Web service in Application Express 4.0. Perhaps we can do a better job of documenting the feature in a future release.
    The Create Report on Web Service response wizard assumes that you already have a process that is using the Web service reference to call the Web service. In that process, you specify the name of the collection to store the results in.
    An easier approach in your case would be to run the Create Form and Report on Web service Wizard. You can then move the process to before or after header, make it unconditional, and hide the form region it will create. First though, you will have to make some changes to your reference. Based on the XML document you have provided, you need to change the XPath to the result set, the Namespace (for this XML document, it should be null), as well as the output parameters. In the case of creating a report on a Web service response, the output parameters are the parts of the document that you want to report on. So here are the specific changes you should make:
    Response XPath: */emps/emp*
    Response Namespace: <leave this blank>
    REST Output Parameters
    Name Path
    empno /empno
    ename /ename
    hiredate /hiredate
    job /job
    sal /sal
    Also, you may wish to review the Application Express 4.0 Web Services Evaluation Guide available at: http://www.oracle.com/technetwork/developer-tools/apex/apex40webservicesevaluationguide-172753.doc.
    Regards,
    Jason

  • Composite Application with RESTful Web Services

    Hello!
    Is it possible to build Composite Application with RESTful Web Services only. I use Glassfishe 2.1 and OpenESB 2.1.
    Can you point me on some tutorials on the net to read about using RESTful Web Services in BPEL?

    Hi Gabriel,
    Let me try to answer some of your questions:
    1) The "Requires Secure Access" attribute of a resource handler controls whether this handler must be accessed/consumed only over SSL (HTTPS). Oracle Database Cloud Schema Service is only offered over SSL, so this attribute does not have any effect on RESTful services deployed in this environment (because secure access is always required and there is no other way). That said, if you want to access such web service from your own APEX instance, your instance must have Oracle Wallet configured with appropriate SSL certificate.
    2) The URI parameters are not required. If your web service returns data for many entities (for example, list of employees in employees/), you may not need a parameter. If your web service returns data for one specific entity (for example, details of one employee in employees/{id}), you may want to identify that entity with a URI parameter.
    3) You can have many URI parameters, for example: customers/{id}/orders/{order_id}.
    4) Yes, these are the same HTTP methods/verbs you would use from PHP.
    5) If you are trying this POST example from your own APEX instance (not Oracle Database Cloud Schema Service) and you are trying to access a web service over SSL, then it is likely that the Oracle Wallet used by your instance does not include the required SSL certificate(s), or the Oracle Wallet is not configured at all.
    6) I recommend to check RESTful Web Services for the Oracle Database Cloud white paper and Oracle REST Data Services Developers Guide. Oracle REST Data Services is the technology that enables RESTful services in the Oracle Database Cloud Schema Service.
    You can certainly create your own web services in the Oracle Database Cloud Schema Service and consume them from the same environment.
    Vlad

  • Pulling user/group field data from SharePoint list using REST, jQuery, Knockout.js Sharepoint 2013

    I'm trying to make an interactive task board based on the task list app in SharePoint 2013. The task lisk includes fields like "Title","Description","Status","% Complete","Due Date","Assigned To",
    etc. I used knockout.js to bind "Title","Description", and "Status" to my HTML controls. Here is some of the code:
    var ViewModal = function(items, listname){
    var self = this;
    self.sortBy = ko.observableArray(sortBy);
    self.tasks = ko.observableArray(items);
    self.listname = ko.observable(listname);
    self.auto = ko.observable(false);
    self.getTasks = function() {
    clearTimeout(self.getTasks);
    // server relative url to REST service endpoint
    var ajaxurl = _spPageContextInfo.webServerRelativeUrl + "/_vti_bin/listdata.svc/" + self.listname() + "?$orderby=PriorityValue";
    $.ajax({
    type: "GET",
    url: ajaxurl,
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    cache: false,
    processData: true,
    success: function (data, status, xhr) {
    if (status == "success" && data) {
    ko.mapping.fromJS(data.d.results, mapping, self.tasks)
    $(".task-item").draggable();
    error: alert
    if (self.auto()) {
    setTimeout(self.getTasks, 10000);
    <div class="tasks-column">
    <div class="column-header">Not Started</div>
    <!-- ko foreach: tasksNotStarted -->
    <div class="task-item">
    <div class="view" data-bind="visible: !IsEditing()">
    <button class="edit" data-bind="click: $root.editTask">edit</button>
    <h2><span data-bind="text: Title"></span></h2>
    <div data-bind="html: Description"></div>
    <span data-bind="text: PriorityValue"></span>
    </div>
    <div class="edit" data-bind="visible: IsEditing">
    <button class="save" data-bind="click: $root.saveTask">save</button>
    <input type="text" data-bind="value: Title"></input>
    </div>
    </div>
    I'm having trouble displaying the data from the "Assigned To" user/group field. I tried:
    <span data-bind="text: AssignedTo"></span>
    But it displays the field as [object Object]
    I tried using $select/$expand
    ?$select=Title,AssignedTo/Id,Assignedto/Title&$expand=AssignedTo/Id,AssignedTo/T‌​itle";
    But it still returns the [object Object]

    Hi,
    Please use the REST URI below:
    /_api/lists/getbytitle('ListName')/items?$select=Title,AssignedTo/ID,AssignedTo/Title&$expand=AssignedTo/ID,AssignedTo/Title
    More information for your reference:
    How to get User Details and User Group Details in SharePoint 2013 REST API with Knockout for SharePoint Js (KoSpJs)
    http://www.ashokraja.me/post/How-to-get-User-Details-and-User-Group-Details-in-SharePoint-2013-REST-API-with-Knockout-for-SharePoint-Js-(KoSpJs).aspx
    How to Get Login Name and Display Name using SharePoint 2013 REST API
    https://www.nothingbutsharepoint.com/sites/devwiki/articles/pages/how-to-get-login-name-and-display-name-using-sharepoint-2013-rest-api.aspx
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Quick Cards Uri Mapper problem

    I'm trying to set up Search Extensibility on my app, but I keep getting an error message "QuickCardUriMapper.MapUri(System.Uri)': not all code paths return a value"
    using System;
    using System.Windows.Navigation;
    using System.Net;
    namespace Malaccaguide
    public class QuickCardUriMapper : UriMapperBase
    private static string TargetPageName = "LocationsPage.xaml";
    private string tempUri;
    public override Uri MapUri(Uri uri)
    tempUri = uri.ToString();
    // Parse URI when launched by from a quick card.
    if (tempUri.Contains("/SearchExtras"))
    // Decode all characters in the URI.
    tempUri = HttpUtility.UrlDecode(tempUri);
    // Create a new URI for place cards.
    if (tempUri.Contains("Bing_Places"))
    return GetPlaceCardUri(tempUri);
    // Immediately return the URI when it isn’t related to Search extensibility.
    return uri;
    // Return a parsed Place Card URI.
    private Uri GetPlaceCardUri(string uri)
    // Extract parameter values from URI.
    string PlaceNameValue = GetURIParameterValue("PlaceName=", uri);
    string PlaceLatitudeValue = GetURIParameterValue("PlaceLatitude=", uri);
    string PlaceLongitudeValue = GetURIParameterValue("PlaceLongitude=", uri);
    string PlaceAddressValue = GetURIParameterValue("PlaceAddress=", uri);
    string CategoryValue = GetURIParameterValue("Category=", uri);
    // Create new URI.
    string NewURI = String.Format("/{0}?PlaceName={1}&PlaceLatitude={2}&PlaceLongitude={3}&PlaceAddress={4}&Category={5}",
    TargetPageName, PlaceNameValue, PlaceLatitudeValue, PlaceLongitudeValue, PlaceAddressValue, CategoryValue);
    return new Uri(NewURI, UriKind.Relative);
    // This method extracts the string values that correspond to URI parameters from a quick card.
    private string GetURIParameterValue(string parameteridentifier, string uri)
    string tempValue = "";
    // If the parameter exists in the string, extract the corresponding parameter value.
    if (uri.Contains(parameteridentifier))
    string subUri;
    // Extract the characters that contain and follow the parameter identifier.
    subUri = uri.Substring(uri.LastIndexOf(parameteridentifier));
    // Remove the parameter identifier from the substring.
    subUri = subUri.Replace(parameteridentifier, "");
    // Obtain the position of the next parameter in the substring.
    int nextParameterPosition = FindNextParameter(subUri);
    if (nextParameterPosition < int.MaxValue)
    // Remove the characters that contain and follow the next parameter.
    tempValue = subUri.Substring(0, nextParameterPosition);
    else
    // No more parameters follow in the string.
    tempValue = subUri;
    // Encode the parameter values to help prevent issues in the URI.
    tempValue = HttpUtility.UrlEncode(tempValue);
    return tempValue;
    // Returns the string position of the next URI parameter, if applicable.
    private int FindNextParameter(string subUri)
    int lowestPosition = int.MaxValue;
    int tempPosition;
    tempPosition = subUri.IndexOf("&ProductName");
    if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
    tempPosition = subUri.IndexOf("&Category");
    if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
    tempPosition = subUri.IndexOf("&PlaceName");
    if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
    tempPosition = subUri.IndexOf("?PlaceName");
    if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
    tempPosition = subUri.IndexOf("&PlaceLatitude");
    if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
    tempPosition = subUri.IndexOf("&PlaceLongitude");
    if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
    tempPosition = subUri.IndexOf("&PlaceAddress");
    if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
    tempPosition = subUri.IndexOf("&MovieName");
    if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
    return lowestPosition;

    Hello,you method MapUri does not return a value in every case:
    This is your code:
    tempUri = uri.ToString();
    // Parse URI when launched by from a quick card.
    if (tempUri.Contains("/SearchExtras"))
    // Decode all characters in the URI.
    tempUri = HttpUtility.UrlDecode(tempUri);
    // Create a new URI for place cards.
    if (tempUri.Contains("Bing_Places"))
    return GetPlaceCardUri(tempUri);
    // Immediately return the URI when it isn’t related to Search extensibility.
    return uri;
    } //END IF
    And this is a better way to do it:
    tempUri = uri.ToString();
    // Parse URI when launched by from a quick card.
    if (tempUri.Contains("/SearchExtras"))
    // Decode all characters in the URI.
    tempUri = HttpUtility.UrlDecode(tempUri);
    // Create a new URI for place cards.
    if (tempUri.Contains("Bing_Places"))
    return GetPlaceCardUri(tempUri);
    // Immediately return the URI when it isn’t related to Search extensibility.
    return uri;
    } //END IF
    return null; //Return null or an empty uri when tempUri does not contain "/SearchExtras".
    Note: You error is shown because you check for an string ("/SearchExtras") and than you return a value: "return uri". But what is when your string does not contains this string? Right, than the if-cluase will be ignored and the code reaches
    its end (after "END IF"). And there it would not return a value.
    I hope i was able to help you :)
    © 2015 Thomas Roskop
    Germany // Deutschland

  • 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.

Maybe you are looking for

  • I am having trouble printing multi-page documents on my Epson printer. 13" Macbook Pro, Adobe InDesign, Epson WF-7520

    I have a multi-page document and I want to print some of the pages, double-sided, to check my work. I can't seem to get the interface to recognise that I want to print a specific range of pages, so it will print just one page [no double-sided] or, I

  • Goods Receipt wrt Outbound delivery and Restrict GR wrt PO!

    Hi, In a scenario of intercompany, i need a functionality! GR should be done only wrt Outbound Delivery but not wrt Purchase order for intercompany document type. Pl. help!

  • What is the message type in a bindingFault?

    I have an invoke that sometimes gets a bindingFault that I'd like to catch. What is the message type for the fault variable of a bindingFault? More generally, where does one go to find the message type for any of the standard system faults? Bret

  • Synchronous Webservice

    Hi all, I need to have a synchronous webservice to communicate with a synchronous send step in BPM.the output message of the webservice is defined and its of more relevence but cant specify the input message of the webservice.whether i need to make a

  • Oracle native API for AQ  - Null pointer exception

    Hi I am trying to enqueue a message to AQ adapter through the java native api. But i am getting a null pointer exception. import java.sql.*; import oracle.AQ.*; Connection db_conn; AQSession aq_sess = null; AQQueueTable q_table = null; AQQueue queue