Strapi API register returning a 400 error - api

I’ve been creating a web app with a login and a registration function and so far everything has been going great. I managed to connect the app to the api/auth/local api endpoint and send some nice post requests.
Now, I’ve been trying to send requests to the http://localhost:1337/api/auth/local/register endpoint and without any success. I’ve been doing this according to:
https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#registration
I keep getting a 400 error:
{
"data": null,
"error": {
"status": 400,
"name": "ApplicationError",
"message": "An error occurred during account creation",
"details": {
}
}
}
If I try to send a request with an email that’s already registered in strapi, the response will give me the correct error:
{
"data": null,
"error": {
"status": 400,
"name": "ApplicationError",
"message": "Email is already taken",
"details": {
}
}
}
In the public and authenticated user roles, I’ve allowed every single one of them, for now.
Enable confirmation emails are set to false.
Email confirmation
Public user permission
For the headers, I’m using Content-type : application/json
the raw json body I'm posting:
{
"email": "manager1#strapi.io",
"password": "testtest1",
"username": "manager1"
}
This is my first project with strapi and so far it went pretty well. I’m not sure if I’m missing out on something or if I’m doing something else wrong.
Any help is appreciated!

I figured it out, it wasn’t as complicated as I expected.
In the user I had different fields, like firstName, lastName etc. All of these fields were required.
I made the fields not required, and now it works.

Related

Foursquare API Error 403 - User not authorized to edit venue

We are trying to update details information for serveral Venues in behalf of our clients/users by using Foursquare API.
It works pretty well for most of the clients, and we are using their own personal oauth credentials most of the time.
BTW, we have a lot of problems with some clients/accounts, because we are getting this error when trying to update the venues:
{
"meta": {
"code": 403,
"errorType": "not_authorized",
"errorDetail": "User not authorized to edit venue",
"requestId": "59bba14e351e3d0e31fcf9f1"
},
"notifications": [
{
"type": "notificationTray",
"item": {
"unreadCount": 0
}
}
],
"response": {}
We’ve checked the API limits and everything it’s correct. We’ve also checked the account Oauth token several times and it’s correct. Even we are using the 'venues/managed’ endpoint to ensure that the given Oauth credential can manage the given Venue and everything looks fine.
Any idea about what's happening?

Twitter Insights API with Postman

I'm trying to read insights of my Twitter account with Twitter Insights API and when I request to that given end point I get and error called :
{
"errors": [
{
"code": "UNAUTHORIZED_ACCESS",
"message": "This request is not properly authenticated"
}
],
"request": {
"params": {}
}
}
This is the end point I tried :
https://ads-api.twitter.com/2/insights/accounts/:account_id/available_audiences
I used the given credentials like Consumer Key, Secret and Token, Token secret.
Can anyone explain me why I'm getting this error ? And what I should do ?
Here is a screenshot
Header:
You have to check box "Add params to header"
Everything else should be ok. Just check Consumer Key, Consumer Secret,... data

Youtube Analytics API - HTTP request for Associated Channel's data

I am new to YouTube Analytics API.
Could you please help me to retrieve data from my associated YouTube channel.
I have populated the data using “youtubeAnalytics.reports.query” in the APIs Explorer window.
But when I am trying to use the below HTTP request
https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3D{MY_ASSOCIATED_CHANNEL_ID}&start-date=2016-08-01&end-date=2016-08-31&metrics=views&dimensions=video&filters=video%3D%3D{MY_VIDEO_ID}&max-results=10&sort=-views&key={MY_API_KEY}
It shows an error message “Login Required”
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Could you please help me to correct my HTTP request to populate the data.
Thanks,
Aneesh
As far as I know most all of the YouTube Analytics API is private data. Being that its private data you need to be authenticated in order to access it.
Your error "Login Required" means exactly that you need to be authenticated to access the data you are requesting. Probably using the scope
https://www.googleapis.com/auth/yt-analytics.readonly
Once you have authenticated your application you can do access_token={Access token gotten from authentication} in order to access that data.

Foursquare API - Tastes

When I try to send a GET request to Foursquare API below, I get "No matching endpoint." error.
I have validated my tokens and everything seems normal. Any advices?
REQUEST URL
https://api.foursquare.com/v2/users/USER_ID/tastes
RESPONSE MESSAGE
{
"meta": {
"code": 404,
"errorType": "endpoint_error",
"errorDetail": "No matching endpoint"
},
"notifications": [
{
"type": "notificationTray",
"item": {
"unreadCount": 0
}
}
],
"response": {}
}
FoursquareAPI twitter account has told me that I needed to pass m=foursquare in addition to version information.
The correct endpoint information is like
https://api.foursquare.com/v2/users/USER_ID/tastes?oauth_token=TOKEN&v=20150420&m=foursquare
The detailed information about v and m parameters are below.
https://developer.foursquare.com/overview/versioning

Fusion table API, INSERT query, bad request

I have a fusion table with fields: username, description,latitude,longitud,geolocation. I am trying to create a new row with information via the google API. I triple checked that the fusion table is open, the tableid and the apikey are correct, and I have the fusiontable API enabled with 0% of the quota. I think the wrong request must be because some coma or quotation mark but to be honest it completely escapes me. I have tried different combinations and cannot find the mistake. Below error that I get, the code that use in php to generate the link and the link itself. Any idea would be greatly appreciated.
Thank you
link returns:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "keyInvalid",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
Php Code:
$apikey = "AIzaSyB4BMlrZIlJB-Apo8t_dO9K18uL8O2s5TA";
$tableid = "1X0rFoG7Tt2Ocm2rE39wPuamZCrFiS4D32Odgbh03";
$username="webuser";
$description="nujkn";
$latitude="78";
$longitud="110";
$geolocation="98.8789, 150.1111";
$link = "https://www.googleapis.com/fusiontables/v1/query?sql=INSERT+INTO+".$tableid."+(username,description,latitude,longitud,geolocation)+VALUES+('".$username."','".$description."','".$latitude."','".$longitud."','".$geolocation."')&key={".$apikey."}";
Link generated: https://www.googleapis.com/fusiontables/v1/query?sql=INSERT+INTO+1X0rFoG7Tt2Ocm2rE39wPuamZCrFiS4D32Odgbh03+(username,description,latitude,longitud,geolocation)+VALUES+('webuser','nujkn','78','110','98.8789')&key={AIzaSyB4BMlrZIlJB-Apo8t_dO9K18uL8O2s5TA}
which in browser looks like: https://www.googleapis.com/fusiontables/v1/query?sql=INSERT+INTO+1X0rFoG7Tt2Ocm2rE39wPuamZCrFiS4D32Odgbh03+(username,description,latitude,longitud,geolocation)+VALUES+(%27webuser%27,%27nujkn%27,%2778%27,%27110%27,%2798.8789%27)&key={AIzaSyB4BMlrZIlJB-Apo8t_dO9K18uL8O2s5TA}