i get the error:
{
"message": "Note content can not be empty"
}
The MongoDB is running and if i start $ node server.js, i get the messages:
Server is listening on port 3000
Successfully connected to the database
if i delete the following lines in note.controller.js. The Response-Status are 200-OK :
//return res.status(400).send({
// message: "Note content can not be empty"
// });
but the 'titel' contains the default content: "title": "Untitled Note".
I guess, it's a problem with the Middleware/ Mongooseenter code here.
Does anyone have a solution?
So, this error occurred to me when I followed the same tutorial, and the reason being that I was not experienced in using the Postman application.
The issue occurs when you choose the body as raw in the POST method by keeping the format of body as Text
For it to work properly, since the date should be in JSON format to be written into MongoDB as per the server configuration, we need to choose the raw body format as Json, as shown in the image below.
Related
I'm trying to add a lookup activity that will look up a series of values(companyIds) and insert the values into here
["/apiCore/api/countries","/apiCore/api/Metrics/MyLookup"]
At present my configuration looks like the following:
I was wondering if it was possible to add Lookup activity to insert the values as follows:
And then enter a parameter like #activity('MyLookup').output.value to:
["/apiCore/api/countries","/apiCore/api/Metrics/MyLookup"] so it change to:
["/apiCore/api/countries","/apiCore/api/Metrics/** #activity('MyLookup').output.value**"]
Can someone let me know if the above would work? If not, do you have any suggestions?
I got the answer to my suggestion with the following error:
{
"errorCode": "2200",
"message": "ErrorCode=HttpRequestFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Http request failed with client error, status code 400 BadRequest, please check your activity settings. If you configured a baseUrl that includes path, please make sure it ends with '/'.\nRequest URL: https://pm2.preqinsolutions.com/apiCore/api/Metrics/#activity('MyLookup').output.value.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (400) Bad Request.,Source=System,'",
"failureType": "UserError",
"target": "dynamoCompanies",
"details": []
}
You will notice the error is with:
#activity('MyLookup').output.value
here:
https://pm2.preqinsolutions.com/apiCore/api/Metrics/#activity('MyLookup').output.value.,
Any suggestions will be very much welcomed
Updated question
Using string interpolation, you can build the URL by adding the output of look up activity. Instead of using the URL as https://pm2.preqinsolutions.com/apiCore/api/Metrics/#activity('MyLookup').output.value, you can try the following:
I have taken a sample lookup which gives the following output:
Now, I have used a variable to build the URL value. I have taken the value /apiCore/api/Metrics/ in a parameter called relativeURL.
https://pm2.preqinsolutions.com#{pipeline().parameters.relativeUrl}#{activity('Lookup1').output.value}
This generates the required URL. When I call it in web activity, you can see the URL that is being passed in debug input (I don't have access to the activity fails).
I'm using Talend Open Studio for ESB - Version: 8.0.1. I have a job that loops thru data and creates a CSV for each data element, like this:
> ID DATA
> A QQQQ#$%$
> B WWWE^UTU
etc. The job creates FileA.csv, then FileB.csv etc. That all works, but the next step I need will take FileA.csv and POST that data to an API.
The URI for each file is different, so I'm using a context to create the link. The links look like this:
https://:#host/updatenodes?application_code=fileA
There is a different application code for each file. I've tested the link for these files in Postman, and they all work, here's the message:
"result": "success",
"message": "Update batch submitted with 0 items",
"threadId": []
So, the links are correct. In Talend ESB, I'm using a tFileFetch object with Post Method checked. The file image_Tal.png shows the settings
of the tFileFetch. When I use a context URL, I get this error:
> Exception in component tFileFetch_1 (Cognosos)
> java.lang.IllegalArgumentException: host parameter is null
I also tried hard-coding the full URL into the filefetch object, I get this error:
Sep 08, 2022 1:49:39 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: no further information
So, how do I post the data from the CSV to the API? I've tried tRest, but it wouldn't allow me to use a context variable as the URI.
Because each different file has a different ID/Password, I need to use a variable for each iteration in the loop. When I use a
context for the URI, it gives me the error "URI is not absolute". I had the same problem with RestRequest and RestClient.
Are there some settings I need to add to Talend ESB? I'm using the defaults now - I'm not sure what settings to change.
![enter image description here](https://i.stack.imgur.com/A6NA3.png)
I've tried the tRest and tRestRequest objects, but I got and error using a context for the URI. I'm trying to get the CSV data to POST to the API.
I have done everything needed to setup webservices on my moodle 3.11 instance, including roles/capabilities/user. However sending a test request always gives {
"exception": "dml_missing_record_exception",
"errorcode": "invalidrecord",
"message": "Can't find data record in database table external_functions."
}
The URL to access it is of the format https:///moodle/webservice/rest/server.php?wsfunction=core_user_create_user&service=mymoodleusermanage&moodlewsrestformat=json&users[0][username]=ABC&users[0][firstname]=VPTest&users[0][lastname]=None&users[0][email]=mail#xxx.com&users[0][password]=xxxxx&users[0][auth]=manual&wstoken=xxxxxxxxxxxxxx
The service parameter is correctly set to the shortname of the service. Does the service have to be defined anywhere additionally apart from Site Administration->Server->Web Services->External Services->Custom Services
Thanks for any help that can be given
The answer is very simple - you are trying to call a non-existent webservice function (hence the error message about being unable to find the database record for the function in the external_functions database table).
If you look in the Moodle code: https://github.com/moodle/moodle/blob/master/lib/db/services.php#L1717 you will see that the function is called core_user_create_users - with an "s" at the end of it.
If you add that extra "s" into the URL parameters you are using, then it should work.
https:///moodle/webservice/rest/server.php?wsfunction=core_user_create_user&service=mymoodleusermanage&moodlewsrestformat=json&users[0][username]=ABC&users[0][firstname]=VPTest&users[0][lastname]=None&users[0][email]=mail#xxx.com&users[0][password]=xxxxx&users[0][auth]=manual&wstoken=xxxxxxxxxxxxxx
you must change username all character small letter [username]=ABC like this [username]=abc and add s wsfunction=core_user_create_users
I'm testing out a few things in the OAuth 2.0 Playground and trying to get data in and out of Google Fit using their REST API
I have done this previously with success, I just didn't write down what I did.. now I've come back to make it a proper thing and can't get it working again.
I have access to Google Fit datasources via the dashboard. I can get a list of the dataSources that exist from:
https://www.googleapis.com/fitness/v1/users/me/dataSources
And that is successful. I have also created my own stream which has a single floating point weight value on it called
raw:com.google.weight:b6ac18c0:dten.sync
It already has data in it, I put it there last time I used it. I can select all that data by requesting a GET on the following
https://www.googleapis.com/fitness/v1/users/me/dataSources/raw:com.google.weight:b6ac18c0:dten.sync/datasets/0-1432193482000000000
It returns me all the data points I entered last time as JSON
I then try to PATCH the data adding my own data to the folliwng URL
https://www.googleapis.com/fitness/v1/users/me/dataSources/raw:com.google.weight:b6ac18c0:dten.sync/datasets/1432193482000000000-1432193482000000000
With this as a the request body
{
"minStartTimeNs": "1421912895000000000",
"maxEndTimeNs": "1432193482000000000",
"dataSourceId": "raw:com.google.weight:b6ac18c0:dten.sync",
"point": [
{
"startTimeNanos": "1421912895000000000",
"modifiedTimeMillis": "1421912895000",
"endTimeNanos": "1421912895000000000",
"value": [
{
"fPVal": 89.1
}
],
"dataTypeName": "com.google.weight"
}
]
}
But I get back
{
"error": {
"code": 400,
"message": "Unable to fetch DataSource for Dataset: raw:com.google.weight:b6ac18c0:dten.sync",
"errors": [
{
"domain": "global",
"message": "Unable to fetch DataSource for Dataset: raw:com.google.weight:b6ac18c0:dten.sync",
"reason": "invalidArgument"
}
]
}
}
I can't find any one referencing a similar anywhere soo I'm here
Also note if I miss spell my source it tells me off because they don't match the URL, if i include an empty list of data points I get the same error. I'm quite lost so I'm throwing it out there to see if anyone knows what that means
Thanks in advance
edit: i tried changing the hex code for my project's integer code and got an error about untrusted source. so i tried making a new test data source which works as expected. Slightly annoyed but guess I'll just start over..
OK I was stupid and didn't set up my own credentials in the OAuth settings in top right of the dashboard as it said to here. I forgot that bit -_- now I can access my own stream again and it shows my integer project id in the stream id not the hex one
https://developers.google.com/fit/rest/v1/get-started
Now I get invalid argument, but.. whatever >_<
edit 2:
invalid argument was because I have fPVal instead of fpVal and modifiedTimeMillis mills is not supposed to be submitted, obviously
i'm working with SapUi5 to build a webapp which connects to our Netweaver Gateway. This App consumes the data successfully, i only have problems to create objects with the service.
The response data i get is
500
Internal Server Error
content-type
application/xml
-
-
001560AA0E081DEB8CA398CC1690D406
Error while parsing an XML stream
-
52FB96CF506729E0E1000000C0A8EA2A
The Gateway error log says
Exception /IWCOR/CX_BAD_REQUEST occured.
When i insert data with the Gateway Client everything works fine.
EDIT
My Object is created like this
var testObject = {
smtp_adr: "ui5#test.de",
first_name: "SapUI5",
last_name: "test",
nr: 9999
};
and i upload it with
oModel.create("/MyService", testObject, null, false, null,function() {
alert("Create successful");
});
500 internal server error is related to payload. You are not passing the data properly to back-end. Please check the data that you are passing from front-end.
The problem is stated in your error message "bad request" ... oModel.create allows 3 parameters (Source)
sPath e.g. /MyService
oData e.g. testObject
mParameters?
You are passing 4 parameters, which leads to a "BAD_REQUEST" ...
Please see this, where its explained how to pass data: SAPUI5 oModel.create() - how to post data to the SAP backend?
Do you have access to the gateway box through SAP GUI can you check the error logs there?
The error your are getting around parsing XML stream most often happens when there is either an additional field in your create model or there is a type mismatch. can you try passing in
var testObject = {
smtp_adr: "ui5#test.de",
first_name: "SapUI5",
last_name: "test",
nr: "9999"
};
And see if that makes a difference most of the times I have seen this the type mismatch has been the issue.