TestUser | 2020-03-17 19:09:10 UTC | #1
We are trying to consume the APi architectApi.postArchitectSchedules, for this i have code snippet to set the body as input to this API and getting and error 400 bad request
var body = { "name": "customer12x1x2", "start": "2020-03-17T11:00:00.000", "end": "2020-03-17T21:00:00.000", "rrule": "FREQ=YEARLY;BYMONTH=3;BYMONTHDAY=17" }; return architectApi.postArchitectSchedules({body1});
Error :- 1. body: {message: "[Request body must not be null]", code: "constraint.validation", status: 400}
- error: Error: Bad Request at h.<anonymous>
tim.smith | 2020-03-17 20:26:34 UTC | #2
I see two likely problems with your code regarding this line: return architectApi.postArchitectSchedules({body1});
- The extra curlys around the variable
body1 shouldn't be there - based on the example you provided,
body1 is not defined. The variable body should be used here.
TestUser | 2020-03-17 20:34:27 UTC | #3
sorry, sample code i posted earlier is not bit messeup, here is the one i'm using
var body = { "name":"customeredited1324", "start": "2020-03-17T11:00:00.000", "end": "2020-03-17T21:00:00.000", };
conversationsApi.postArchitectSchedules(body).then(function(result){ console.log("created successfullu"); console.log(result); }).catch(function(error){ console.error("Error creatin schedulel", error); });
tim.smith | 2020-03-17 20:42:46 UTC | #4
Can you grab the correlation ID from the response?
TestUser | 2020-03-17 20:58:30 UTC | #5
tim.smith, post:4, topic:7369
correlation
inin-correlation-id: "dcdf37af-6889-47b7-bd74-ee525f5237b8"
Request sent : var body = { "name":"customeredited13245a", "start": "2020-03-17T11:00:00.000", "end": "2020-03-17T21:00:00.000", }; alert("calling the method");
conversationsApi.postArchitectSchedules(body).then(function(result){
when have tried the same format from "https://developer.mypurecloud.com/developer-tools/#/codeeditor" and that worked, only problem when i do this from my code
var body = { "name":"customeredited1a23", "start": "2020-03-17T11:00:00.000", "end": "2020-03-17T21:00:00.000",
}; alert(body);
architectApi.postArchitectSchedules(body).then(function(result){
tim.smith | 2020-03-17 21:05:06 UTC | #6
TestUser, post:5, topic:7369
conversationsApi.postArchitectSchedules(body).then(function(result){
Maybe it's a problem with that line. The Conversations API doesn't have that method. Can you get the correlation ID from the response?
TestUser | 2020-03-17 21:12:45 UTC | #7
it is just the name i used, but referring to correct api class
const conversationsApi = new platformClient.ArchitectApi();
inin-correlation-id: "cfe7761a-eddc-4b40-89ef-ce924a582bdc" is this the one? if not please let me know where i can i find this?
tim.smith | 2020-03-17 22:13:04 UTC | #8
The correlation ID doesn't show anything other than the error about not sending a body.
TestUser, post:5, topic:7369
have tried the same format from "https://developer.mypurecloud.com/developer-tools/#/codeeditor" and that worked,
Especially since it works in one place and not the other, it seems likely that there's an error in your code somewhere. Also, make sure you're using the latest version of the SDK so the methods it offers match the current state of the API itself and the SDK documentation.
TestUser | 2020-03-18 03:37:20 UTC | #9
thank you for that suggestion, it worked, i was using older version of SDK, now updated my code to refer the latest version and it worked. you saved my day, thank you so much
system | 2020-04-18 03:37:22 UTC | #10
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 7369