ODATA: Special Character in URL
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
add a comment |
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
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
add a comment |
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
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
odata
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Jan 2 at 17:14


Andre FAndre F
2961214
2961214
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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