ODATA: Special Character in URL












0















I am facing an issue in creating a ODATA URL.



For the Following URL,



https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=AccountID eq '1000024'



Result :



- <m:properties>
<d:ObjectID>00163E10AD0B1ED686EF458B4E8C51D5</d:ObjectID>
<d:ParentObjectID>00163E10AD201EE5A4F0B592DE751AE8</d:ParentObjectID
<d:AccountID>1000024</d:AccountID>
<d:ContactID>1002636</d:ContactID>
<d:FunctionCode>Z021</d:FunctionCode>
<d:Mobile>+33 123456789</d:Mobile>
<d:Phone>+33 987654321</d:Phone>
</m:properties>


Same for result when i change filter to FunctionCode
https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=FunctionCode eq 'Z021'



But When I search with filter Phone



https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=Phone eq '+33 123456789'



URL doesnt work at all. Is it becuase of special character "+" in Phone Number



I tried with $filter=endswith(Phone, '123456789'), It worked fine. But this is not solution i am looking for.



Can any one suggest another ways?



Thank you
Regards
Prat










share|improve this question























  • Have you tried using %2B instead of the special character + in the url?

    – Andre F
    Jan 2 at 16:52













  • @AndreF : $filter=Phone eq '%2B 123456789' , I tried this one , But no luck.

    – GameBuilder
    Jan 2 at 16:57











  • Try this $filter=Phone eq '%2B 33123456789'

    – Andre F
    Jan 2 at 17:06






  • 1





    or if we're looking for an exact match this $filter=Phone eq '%2B33 123456789'

    – Andre F
    Jan 2 at 17:09











  • Thank you this works fine.

    – GameBuilder
    Jan 2 at 17:11
















0















I am facing an issue in creating a ODATA URL.



For the Following URL,



https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=AccountID eq '1000024'



Result :



- <m:properties>
<d:ObjectID>00163E10AD0B1ED686EF458B4E8C51D5</d:ObjectID>
<d:ParentObjectID>00163E10AD201EE5A4F0B592DE751AE8</d:ParentObjectID
<d:AccountID>1000024</d:AccountID>
<d:ContactID>1002636</d:ContactID>
<d:FunctionCode>Z021</d:FunctionCode>
<d:Mobile>+33 123456789</d:Mobile>
<d:Phone>+33 987654321</d:Phone>
</m:properties>


Same for result when i change filter to FunctionCode
https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=FunctionCode eq 'Z021'



But When I search with filter Phone



https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=Phone eq '+33 123456789'



URL doesnt work at all. Is it becuase of special character "+" in Phone Number



I tried with $filter=endswith(Phone, '123456789'), It worked fine. But this is not solution i am looking for.



Can any one suggest another ways?



Thank you
Regards
Prat










share|improve this question























  • Have you tried using %2B instead of the special character + in the url?

    – Andre F
    Jan 2 at 16:52













  • @AndreF : $filter=Phone eq '%2B 123456789' , I tried this one , But no luck.

    – GameBuilder
    Jan 2 at 16:57











  • Try this $filter=Phone eq '%2B 33123456789'

    – Andre F
    Jan 2 at 17:06






  • 1





    or if we're looking for an exact match this $filter=Phone eq '%2B33 123456789'

    – Andre F
    Jan 2 at 17:09











  • Thank you this works fine.

    – GameBuilder
    Jan 2 at 17:11














0












0








0








I am facing an issue in creating a ODATA URL.



For the Following URL,



https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=AccountID eq '1000024'



Result :



- <m:properties>
<d:ObjectID>00163E10AD0B1ED686EF458B4E8C51D5</d:ObjectID>
<d:ParentObjectID>00163E10AD201EE5A4F0B592DE751AE8</d:ParentObjectID
<d:AccountID>1000024</d:AccountID>
<d:ContactID>1002636</d:ContactID>
<d:FunctionCode>Z021</d:FunctionCode>
<d:Mobile>+33 123456789</d:Mobile>
<d:Phone>+33 987654321</d:Phone>
</m:properties>


Same for result when i change filter to FunctionCode
https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=FunctionCode eq 'Z021'



But When I search with filter Phone



https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=Phone eq '+33 123456789'



URL doesnt work at all. Is it becuase of special character "+" in Phone Number



I tried with $filter=endswith(Phone, '123456789'), It worked fine. But this is not solution i am looking for.



Can any one suggest another ways?



Thank you
Regards
Prat










share|improve this question














I am facing an issue in creating a ODATA URL.



For the Following URL,



https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=AccountID eq '1000024'



Result :



- <m:properties>
<d:ObjectID>00163E10AD0B1ED686EF458B4E8C51D5</d:ObjectID>
<d:ParentObjectID>00163E10AD201EE5A4F0B592DE751AE8</d:ParentObjectID
<d:AccountID>1000024</d:AccountID>
<d:ContactID>1002636</d:ContactID>
<d:FunctionCode>Z021</d:FunctionCode>
<d:Mobile>+33 123456789</d:Mobile>
<d:Phone>+33 987654321</d:Phone>
</m:properties>


Same for result when i change filter to FunctionCode
https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=FunctionCode eq 'Z021'



But When I search with filter Phone



https://xxxxxxx.xxx.xxxxxxxx.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountHasContactPersonCollection?$filter=Phone eq '+33 123456789'



URL doesnt work at all. Is it becuase of special character "+" in Phone Number



I tried with $filter=endswith(Phone, '123456789'), It worked fine. But this is not solution i am looking for.



Can any one suggest another ways?



Thank you
Regards
Prat







odata






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 16:30









GameBuilderGameBuilder

60922153




60922153













  • Have you tried using %2B instead of the special character + in the url?

    – Andre F
    Jan 2 at 16:52













  • @AndreF : $filter=Phone eq '%2B 123456789' , I tried this one , But no luck.

    – GameBuilder
    Jan 2 at 16:57











  • Try this $filter=Phone eq '%2B 33123456789'

    – Andre F
    Jan 2 at 17:06






  • 1





    or if we're looking for an exact match this $filter=Phone eq '%2B33 123456789'

    – Andre F
    Jan 2 at 17:09











  • Thank you this works fine.

    – GameBuilder
    Jan 2 at 17:11



















  • Have you tried using %2B instead of the special character + in the url?

    – Andre F
    Jan 2 at 16:52













  • @AndreF : $filter=Phone eq '%2B 123456789' , I tried this one , But no luck.

    – GameBuilder
    Jan 2 at 16:57











  • Try this $filter=Phone eq '%2B 33123456789'

    – Andre F
    Jan 2 at 17:06






  • 1





    or if we're looking for an exact match this $filter=Phone eq '%2B33 123456789'

    – Andre F
    Jan 2 at 17:09











  • Thank you this works fine.

    – GameBuilder
    Jan 2 at 17:11

















Have you tried using %2B instead of the special character + in the url?

– Andre F
Jan 2 at 16:52







Have you tried using %2B instead of the special character + in the url?

– Andre F
Jan 2 at 16:52















@AndreF : $filter=Phone eq '%2B 123456789' , I tried this one , But no luck.

– GameBuilder
Jan 2 at 16:57





@AndreF : $filter=Phone eq '%2B 123456789' , I tried this one , But no luck.

– GameBuilder
Jan 2 at 16:57













Try this $filter=Phone eq '%2B 33123456789'

– Andre F
Jan 2 at 17:06





Try this $filter=Phone eq '%2B 33123456789'

– Andre F
Jan 2 at 17:06




1




1





or if we're looking for an exact match this $filter=Phone eq '%2B33 123456789'

– Andre F
Jan 2 at 17:09





or if we're looking for an exact match this $filter=Phone eq '%2B33 123456789'

– Andre F
Jan 2 at 17:09













Thank you this works fine.

– GameBuilder
Jan 2 at 17:11





Thank you this works fine.

– GameBuilder
Jan 2 at 17:11












1 Answer
1






active

oldest

votes


















1














The reason is that these special characters has different meaning when used in URLs. The JavaScript “encodeUri” or “encodeUriComponent” does not solve this problem.



Here is the list of the special characters that needs to be replaced when used in the OData queries:
https://msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx



The special character + Indicates a space (and spaces cannot be used in a URL) so you need to replace the character's with its hexadecimal value, in this case %2B.



Your corrected filter should then be $filter=Phone eq '%2B33 123456789'.



Find a good article here.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54009856%2fodata-special-character-in-url%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    The reason is that these special characters has different meaning when used in URLs. The JavaScript “encodeUri” or “encodeUriComponent” does not solve this problem.



    Here is the list of the special characters that needs to be replaced when used in the OData queries:
    https://msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx



    The special character + Indicates a space (and spaces cannot be used in a URL) so you need to replace the character's with its hexadecimal value, in this case %2B.



    Your corrected filter should then be $filter=Phone eq '%2B33 123456789'.



    Find a good article here.






    share|improve this answer




























      1














      The reason is that these special characters has different meaning when used in URLs. The JavaScript “encodeUri” or “encodeUriComponent” does not solve this problem.



      Here is the list of the special characters that needs to be replaced when used in the OData queries:
      https://msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx



      The special character + Indicates a space (and spaces cannot be used in a URL) so you need to replace the character's with its hexadecimal value, in this case %2B.



      Your corrected filter should then be $filter=Phone eq '%2B33 123456789'.



      Find a good article here.






      share|improve this answer


























        1












        1








        1







        The reason is that these special characters has different meaning when used in URLs. The JavaScript “encodeUri” or “encodeUriComponent” does not solve this problem.



        Here is the list of the special characters that needs to be replaced when used in the OData queries:
        https://msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx



        The special character + Indicates a space (and spaces cannot be used in a URL) so you need to replace the character's with its hexadecimal value, in this case %2B.



        Your corrected filter should then be $filter=Phone eq '%2B33 123456789'.



        Find a good article here.






        share|improve this answer













        The reason is that these special characters has different meaning when used in URLs. The JavaScript “encodeUri” or “encodeUriComponent” does not solve this problem.



        Here is the list of the special characters that needs to be replaced when used in the OData queries:
        https://msdn.microsoft.com/en-us/library/aa226544(SQL.80).aspx



        The special character + Indicates a space (and spaces cannot be used in a URL) so you need to replace the character's with its hexadecimal value, in this case %2B.



        Your corrected filter should then be $filter=Phone eq '%2B33 123456789'.



        Find a good article here.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 2 at 17:14









        Andre FAndre F

        2961214




        2961214
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54009856%2fodata-special-character-in-url%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith