Apex REST API - Unable to set StatusCode to 429unable to create user with REST api emailApex REST Web Service: Unexpected parameter encountered during deserializationMessageDefinitionSends Rest API successful response but never sends emailUploading a file to Chatter - REST APIWhen generate Pdf from trigger, getting Error ( HttpResponse[Status=Bad Request, StatusCode=400]),Allow Access origin Issue With Rest Api For Patch MethodStatus=Bad Request, StatusCode=400 on rest api callSalesforce REST API CallREST API call via Postman to read JourneyMarketing Cloud REST API “Not Authorized” error in Postman
Symbol for "not absolutely continuous" in Latex
What's the safest way to inform a new user of their password on an invite-only website?
Multiple computers 1 minecraft
How did Lefschetz do mathematics without hands?
Should I report a leak of confidential HR information?
Single level file directory
What's the rule for a natural 20 on a Perception check?
Put my student loan in parents’ second mortgage - help?
How is this practical and very old scene shot?
What does grep -v "grep" mean and do?
Could human civilization live 150 years in a nuclear-powered aircraft carrier colony without resorting to mass killing/ cannibalism?
In native German words, is Q always followed by U, as in English?
Movie in a trailer park named Paradise and a boy playing a video game then being recruited by aliens to fight in space
What game is this character in the Pixels movie from?
What is "oversubscription" in Networking?
Is it okay to fade a human face just to create some space to place important content over it?
Why were the first airplanes "backwards"?
Why was Mal so quick to drop Bester in favour of Kaylee?
Can I travel from Germany to England alone as an unaccompanied minor?
Adjective for 'made of pus' or 'corrupted by pus' or something of something of pus
Can Aziraphale and Crowley actually become native?
Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?
Who are these Discworld wizards from this picture?
Different budgets within roommate group
Apex REST API - Unable to set StatusCode to 429
unable to create user with REST api emailApex REST Web Service: Unexpected parameter encountered during deserializationMessageDefinitionSends Rest API successful response but never sends emailUploading a file to Chatter - REST APIWhen generate Pdf from trigger, getting Error ( HttpResponse[Status=Bad Request, StatusCode=400]),Allow Access origin Issue With Rest Api For Patch MethodStatus=Bad Request, StatusCode=400 on rest api callSalesforce REST API CallREST API call via Postman to read JourneyMarketing Cloud REST API “Not Authorized” error in Postman
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to set the status code to 429 for Too many request using the code below:
if(Limits.getQueries() < Limits.getLimitQueries())
upsert UpdateData;
else if((Limits.getQueries() >= Limits.getLimitQueries()))
RestContext.response.statusCode = 429;
UpdateError[] err = new UpdateError[]
new UpdateReturnError(UpdateData.Id, 'Too many Requests', 'Error updating MessageID ' + msg.MessageId)
;
RestContext.response.responseBody = Blob.valueOf(JSON.serialize(err));
RestContext.response.addHeader('Content-Type', 'application/json');
break;
}
I am getting the following error in the raw response:
Can someone help me out with this?
apex rest-api apexrest rest-service
New contributor
add a comment |
I am trying to set the status code to 429 for Too many request using the code below:
if(Limits.getQueries() < Limits.getLimitQueries())
upsert UpdateData;
else if((Limits.getQueries() >= Limits.getLimitQueries()))
RestContext.response.statusCode = 429;
UpdateError[] err = new UpdateError[]
new UpdateReturnError(UpdateData.Id, 'Too many Requests', 'Error updating MessageID ' + msg.MessageId)
;
RestContext.response.responseBody = Blob.valueOf(JSON.serialize(err));
RestContext.response.addHeader('Content-Type', 'application/json');
break;
}
I am getting the following error in the raw response:
Can someone help me out with this?
apex rest-api apexrest rest-service
New contributor
add a comment |
I am trying to set the status code to 429 for Too many request using the code below:
if(Limits.getQueries() < Limits.getLimitQueries())
upsert UpdateData;
else if((Limits.getQueries() >= Limits.getLimitQueries()))
RestContext.response.statusCode = 429;
UpdateError[] err = new UpdateError[]
new UpdateReturnError(UpdateData.Id, 'Too many Requests', 'Error updating MessageID ' + msg.MessageId)
;
RestContext.response.responseBody = Blob.valueOf(JSON.serialize(err));
RestContext.response.addHeader('Content-Type', 'application/json');
break;
}
I am getting the following error in the raw response:
Can someone help me out with this?
apex rest-api apexrest rest-service
New contributor
I am trying to set the status code to 429 for Too many request using the code below:
if(Limits.getQueries() < Limits.getLimitQueries())
upsert UpdateData;
else if((Limits.getQueries() >= Limits.getLimitQueries()))
RestContext.response.statusCode = 429;
UpdateError[] err = new UpdateError[]
new UpdateReturnError(UpdateData.Id, 'Too many Requests', 'Error updating MessageID ' + msg.MessageId)
;
RestContext.response.responseBody = Blob.valueOf(JSON.serialize(err));
RestContext.response.addHeader('Content-Type', 'application/json');
break;
}
I am getting the following error in the raw response:
Can someone help me out with this?
apex rest-api apexrest rest-service
apex rest-api apexrest rest-service
New contributor
New contributor
New contributor
asked 8 hours ago
John MJohn M
133 bronze badges
133 bronze badges
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
429 Too Many Requests
is not an appropriate status to return from Apex that is processing a REST request, and so presumably that's why the server prevents you from doing so. The relevent RFC indicates that this response is for rate-limiting, ie, the number of HTTP requests received from a single client in a given amount of time:
The 429 status code indicates that the user has sent too many
requests in a given amount of time ("rate limiting").
The response representations SHOULD include details explaining the
condition, and MAY include a Retry-After header indicating how long
to wait before making a new request.
Each REST request will be a separate Apex transaction, and the # of SOQL queries issued is a per-transaction limit. So exceeding that limit would never be because too many calls to your endpoint had come from a single client in a given period of time.
The documentation for the RestResponse
class lists the acceptable values for the statusCode
property, and 429
is not included.
This should probably be a 200
response, or perhaps a 500
. You're successfully receiving and processing the HTTP request. It's just that the result of that request exceeded a limit, but that limit is at a layer much further down than the HTTP server.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
);
);
John M is a new contributor. Be nice, and check out our Code of Conduct.
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%2fsalesforce.stackexchange.com%2fquestions%2f267246%2fapex-rest-api-unable-to-set-statuscode-to-429%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
429 Too Many Requests
is not an appropriate status to return from Apex that is processing a REST request, and so presumably that's why the server prevents you from doing so. The relevent RFC indicates that this response is for rate-limiting, ie, the number of HTTP requests received from a single client in a given amount of time:
The 429 status code indicates that the user has sent too many
requests in a given amount of time ("rate limiting").
The response representations SHOULD include details explaining the
condition, and MAY include a Retry-After header indicating how long
to wait before making a new request.
Each REST request will be a separate Apex transaction, and the # of SOQL queries issued is a per-transaction limit. So exceeding that limit would never be because too many calls to your endpoint had come from a single client in a given period of time.
The documentation for the RestResponse
class lists the acceptable values for the statusCode
property, and 429
is not included.
This should probably be a 200
response, or perhaps a 500
. You're successfully receiving and processing the HTTP request. It's just that the result of that request exceeded a limit, but that limit is at a layer much further down than the HTTP server.
add a comment |
429 Too Many Requests
is not an appropriate status to return from Apex that is processing a REST request, and so presumably that's why the server prevents you from doing so. The relevent RFC indicates that this response is for rate-limiting, ie, the number of HTTP requests received from a single client in a given amount of time:
The 429 status code indicates that the user has sent too many
requests in a given amount of time ("rate limiting").
The response representations SHOULD include details explaining the
condition, and MAY include a Retry-After header indicating how long
to wait before making a new request.
Each REST request will be a separate Apex transaction, and the # of SOQL queries issued is a per-transaction limit. So exceeding that limit would never be because too many calls to your endpoint had come from a single client in a given period of time.
The documentation for the RestResponse
class lists the acceptable values for the statusCode
property, and 429
is not included.
This should probably be a 200
response, or perhaps a 500
. You're successfully receiving and processing the HTTP request. It's just that the result of that request exceeded a limit, but that limit is at a layer much further down than the HTTP server.
add a comment |
429 Too Many Requests
is not an appropriate status to return from Apex that is processing a REST request, and so presumably that's why the server prevents you from doing so. The relevent RFC indicates that this response is for rate-limiting, ie, the number of HTTP requests received from a single client in a given amount of time:
The 429 status code indicates that the user has sent too many
requests in a given amount of time ("rate limiting").
The response representations SHOULD include details explaining the
condition, and MAY include a Retry-After header indicating how long
to wait before making a new request.
Each REST request will be a separate Apex transaction, and the # of SOQL queries issued is a per-transaction limit. So exceeding that limit would never be because too many calls to your endpoint had come from a single client in a given period of time.
The documentation for the RestResponse
class lists the acceptable values for the statusCode
property, and 429
is not included.
This should probably be a 200
response, or perhaps a 500
. You're successfully receiving and processing the HTTP request. It's just that the result of that request exceeded a limit, but that limit is at a layer much further down than the HTTP server.
429 Too Many Requests
is not an appropriate status to return from Apex that is processing a REST request, and so presumably that's why the server prevents you from doing so. The relevent RFC indicates that this response is for rate-limiting, ie, the number of HTTP requests received from a single client in a given amount of time:
The 429 status code indicates that the user has sent too many
requests in a given amount of time ("rate limiting").
The response representations SHOULD include details explaining the
condition, and MAY include a Retry-After header indicating how long
to wait before making a new request.
Each REST request will be a separate Apex transaction, and the # of SOQL queries issued is a per-transaction limit. So exceeding that limit would never be because too many calls to your endpoint had come from a single client in a given period of time.
The documentation for the RestResponse
class lists the acceptable values for the statusCode
property, and 429
is not included.
This should probably be a 200
response, or perhaps a 500
. You're successfully receiving and processing the HTTP request. It's just that the result of that request exceeded a limit, but that limit is at a layer much further down than the HTTP server.
edited 7 hours ago
answered 7 hours ago
Thomas TaylorThomas Taylor
2,87313 silver badges33 bronze badges
2,87313 silver badges33 bronze badges
add a comment |
add a comment |
John M is a new contributor. Be nice, and check out our Code of Conduct.
John M is a new contributor. Be nice, and check out our Code of Conduct.
John M is a new contributor. Be nice, and check out our Code of Conduct.
John M is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Salesforce Stack Exchange!
- 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%2fsalesforce.stackexchange.com%2fquestions%2f267246%2fapex-rest-api-unable-to-set-statuscode-to-429%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