diff --git a/docs/_sources/api/auth.rst.txt b/docs/_sources/api/auth.rst.txt index 265416ca..c5c7dc6e 100644 --- a/docs/_sources/api/auth.rst.txt +++ b/docs/_sources/api/auth.rst.txt @@ -1,8 +1,6 @@ Authentication ############## -work in progress - .. autoflask:: fittrackee_api:create_app() :endpoints: auth.register_user, diff --git a/docs/api/activities.html b/docs/api/activities.html index 7d6f44dd..1189b658 100644 --- a/docs/api/activities.html +++ b/docs/api/activities.html @@ -461,7 +461,7 @@
Form Parameters
@@ -473,7 +473,13 @@
Status Codes
@@ -757,7 +763,7 @@
  • 204 No Content – activity deleted

  • 401 Unauthorized – invalid token

  • 404 Not Found – activity not found

  • -
  • 500 Internal Server Error

  • +
  • 500 Internal Server Error – Error. Please try again or contact the administrator.

  • diff --git a/docs/api/auth.html b/docs/api/auth.html index ae6f6e35..77bd8297 100644 --- a/docs/api/auth.html +++ b/docs/api/auth.html @@ -123,47 +123,387 @@

    Authentication

    -

    work in progress

    POST /api/auth/register

    register a user

    +

    Example request:

    +
    POST /auth/register HTTP/1.1
    +Content-Type: application/json
    +
    +
    +

    Example responses:

    +
      +
    • successful registration

    • +
    +
    HTTP/1.1 201 CREATED
    +Content-Type: application/json
    +
    +{
    +  "auth_token": "JSON Web Token",
    +  "message": "Successfully registered.",
    +  "status": "success"
    +}
    +
    +
    +
      +
    • error on registration

    • +
    +
    HTTP/1.1 400 BAD REQUEST
    +Content-Type: application/json
    +
    +{
    +  "message": "Errors: Valid email must be provided.\n",
    +  "status": "error"
    +}
    +
    +
    +
    +
    Request JSON Object
    +
      +
    • username (string) – user name (3 to 12 characters required)

    • +
    • email (string) – user email

    • +
    • password (string) – password (8 characters required)

    • +
    • password_conf (string) – password confirmation

    • +
    +
    +
    Status Codes
    +
      +
    • 201 Created – Successfully registered.

    • +
    • 400 Bad Request

        +
      • Invalid payload.

      • +
      • Sorry. That user already exists.

      • +
      • +
        Errors:
          +
        • Username: 3 to 12 characters required.

        • +
        • Valid email must be provided.

        • +
        • Password and password confirmation don’t match.

        • +
        • Password: 8 characters required.

        • +
        +
        +
        +
      • +
      +

    • +
    • 500 Internal Server Error – Error. Please try again or contact the administrator.

    • +
    +
    +
    POST /api/auth/login

    user login

    +

    Example request:

    +
    POST /auth/login HTTP/1.1
    +Content-Type: application/json
    +
    +
    +

    Example responses:

    +
      +
    • successful login

    • +
    +
    HTTP/1.1 200 OK
    +Content-Type: application/json
    +
    +{
    +  "auth_token": "JSON Web Token",
    +  "message": "Successfully logged in.",
    +  "status": "success"
    +}
    +
    +
    +
      +
    • error on login

    • +
    +
    HTTP/1.1 404 NOT FOUND
    +Content-Type: application/json
    +
    +{
    +  "message": "Invalid credentials.",
    +  "status": "error"
    +}
    +
    +
    +
    +
    Request JSON Object
    +
      +
    • email (string) – user email

    • +
    • password_conf (string) – password confirmation

    • +
    +
    +
    Status Codes
    +
    +
    +
    GET /api/auth/logout

    user logout

    +

    Example request:

    +
    GET /auth/logout HTTP/1.1
    +Content-Type: application/json
    +
    +
    +

    Example responses:

    +
      +
    • successful logout

    • +
    +
    HTTP/1.1 200 OK
    +Content-Type: application/json
    +
    +{
    +  "message": "Successfully logged out.",
    +  "status": "success"
    +}
    +
    +
    +
      +
    • error on login

    • +
    +
    HTTP/1.1 401 UNAUTHORIZED
    +Content-Type: application/json
    +
    +{
    +  "message": "Provide a valid auth token.",
    +  "status": "error"
    +}
    +
    +
    +
    +
    Request Headers
    +
    +
    +
    Status Codes
    +
    +
    +
    GET /api/auth/profile

    get authenticated user info

    +

    Example request:

    +
    GET /auth/profile HTTP/1.1
    +Content-Type: application/json
    +
    +
    +

    Example response:

    +
    HTTP/1.1 200 OK
    +Content-Type: application/json
    +
    +{
    +  "data": {
    +    "admin": false,
    +    "bio": null,
    +    "birth_date": null,
    +    "created_at": "Sun, 14 Jul 2019 14:09:58 GMT",
    +    "email": "admin@example.com",
    +    "first_name": null,
    +    "id": 2,
    +    "last_name": null,
    +    "location": null,
    +    "nb_activities": 6,
    +    "nb_sports": 3,
    +    "picture": false,
    +    "timezone": "Europe/Paris",
    +    "total_distance": 67.895,
    +    "total_duration": "6:50:27",
    +    "username": "sam"
    +  },
    +  "status": "success"
    +}
    +
    +
    +
    +
    Request Headers
    +
    +
    +
    Status Codes
    +
    +
    +
    POST /api/auth/profile/edit

    edit authenticated user

    +

    Example request:

    +
    POST /auth/profile/edit HTTP/1.1
    +Content-Type: application/json
    +
    +
    +

    Example response:

    +
    HTTP/1.1 200 OK
    +Content-Type: application/json
    +
    +{
    +  "data": {
    +    "admin": false,
    +    "bio": null,
    +    "birth_date": null,
    +    "created_at": "Sun, 14 Jul 2019 14:09:58 GMT",
    +    "email": "admin@example.com",
    +    "first_name": null,
    +    "id": 2,
    +    "last_name": null,
    +    "location": null,
    +    "nb_activities": 6,
    +    "nb_sports": 3,
    +    "picture": false,
    +    "timezone": "Europe/Paris",
    +    "total_distance": 67.895,
    +    "total_duration": "6:50:27",
    +    "username": "sam"
    +  },
    +  "status": "success"
    +}
    +
    +
    +
    +
    Request JSON Object
    +
      +
    • first_name (string) – user first name

    • +
    • last_name (string) – user last name

    • +
    • location (string) – user location

    • +
    • bio (string) – user biography

    • +
    • birth_date (string) – user birth date (format: %Y-%m-%d)

    • +
    • password (string) – user password

    • +
    • password_conf (string) – user password confirmation

    • +
    • timezone (string) – user time zone

    • +
    +
    +
    Request Headers
    +
    +
    +
    Status Codes
    +
    +
    +
    POST /api/auth/picture

    update authenticated user picture

    +

    Example request:

    +
    POST /auth/picture HTTP/1.1
    +Content-Type: multipart/form-data
    +
    +
    +

    Example response:

    +
    HTTP/1.1 200 OK
    +Content-Type: application/json
    +
    +{
    +  "data": {
    +    "admin": false,
    +    "bio": null,
    +    "birth_date": null,
    +    "created_at": "Sun, 14 Jul 2019 14:09:58 GMT",
    +    "email": "admin@example.com",
    +    "first_name": null,
    +    "id": 2,
    +    "last_name": null,
    +    "location": null,
    +    "nb_activities": 6,
    +    "nb_sports": 3,
    +    "picture": false,
    +    "timezone": "Europe/Paris",
    +    "total_distance": 67.895,
    +    "total_duration": "6:50:27",
    +    "username": "sam"
    +  },
    +  "status": "success"
    +}
    +
    +
    +
    +
    Form Parameters
    +
      +
    • file – image file (allowed extensions: .jpg, .png, .gif)

    • +
    +
    +
    Request Headers
    +
    +
    +
    Status Codes
    +
    +
    +
    DELETE /api/auth/picture

    delete authenticated user picture

    +

    Example request:

    +
    DELETE /auth/picture HTTP/1.1
    +Content-Type: application/json
    +
    +
    +

    Example response:

    +
    HTTP/1.1 204 NO CONTENT
    +Content-Type: application/json
    +
    +
    +
    +
    Request Headers
    +
    +
    +
    Status Codes
    +
    +
    +
    diff --git a/docs/searchindex.js b/docs/searchindex.js index 3cda31bd..f3ad679f 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["api/activities","api/auth","api/index","api/records","api/sports","api/stats","api/users","changelog","features","index","installation","troubleshooting/administrator","troubleshooting/index","troubleshooting/user"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:56},filenames:["api/activities.rst","api/auth.rst","api/index.rst","api/records.rst","api/sports.rst","api/stats.rst","api/users.rst","changelog.md","features.rst","index.rst","installation.rst","troubleshooting/administrator.rst","troubleshooting/index.rst","troubleshooting/user.rst"],objects:{"":{"/api/activities":[0,1,1,"post--api-activities"],"/api/activities/(int:activity_id)":[0,3,1,"patch--api-activities-(int-activity_id)"],"/api/activities/(int:activity_id)/chart_data":[0,0,1,"get--api-activities-(int-activity_id)-chart_data"],"/api/activities/(int:activity_id)/gpx":[0,0,1,"get--api-activities-(int-activity_id)-gpx"],"/api/activities/map/(map_id)":[0,0,1,"get--api-activities-map-(map_id)"],"/api/activities/no_gpx":[0,1,1,"post--api-activities-no_gpx"],"/api/auth/login":[1,1,1,"post--api-auth-login"],"/api/auth/logout":[1,0,1,"get--api-auth-logout"],"/api/auth/picture":[1,1,1,"post--api-auth-picture"],"/api/auth/profile":[1,0,1,"get--api-auth-profile"],"/api/auth/profile/edit":[1,1,1,"post--api-auth-profile-edit"],"/api/auth/register":[1,1,1,"post--api-auth-register"],"/api/ping":[6,0,1,"get--api-ping"],"/api/records":[3,0,1,"get--api-records"],"/api/sports":[4,1,1,"post--api-sports"],"/api/sports/(int:sport_id)":[4,3,1,"patch--api-sports-(int-sport_id)"],"/api/stats/(int:user_id)/by_sport":[5,0,1,"get--api-stats-(int-user_id)-by_sport"],"/api/stats/(int:user_id)/by_time":[5,0,1,"get--api-stats-(int-user_id)-by_time"],"/api/users":[6,0,1,"get--api-users"],"/api/users/(user_id)":[6,0,1,"get--api-users-(user_id)"],"/api/users/(user_id)/picture":[6,0,1,"get--api-users-(user_id)-picture"]}},objnames:{"0":["http","get","HTTP get"],"1":["http","post","HTTP post"],"2":["http","delete","HTTP delete"],"3":["http","patch","HTTP patch"]},objtypes:{"0":"http:get","1":"http:post","2":"http:delete","3":"http:patch"},terms:{"default":0,"export":9,"float":0,"int":[0,4,5],"null":0,"return":0,"static":10,NOT:0,Not:0,The:10,Use:7,accord:9,account:8,acit:0,activ:[2,5,7,9],activity_d:0,activity_id:0,adapt:10,add:[7,8,9],admin:[8,10],administr:[8,9,12],all:[3,4,6,10],allow:9,alpinequest:9,also:9,android:9,api:[0,1,3,4,5,6,8,9,10,11],app:9,applic:[0,9,10],arch:10,archiv:10,ascent:0,auth:[0,1],auth_user_id:0,authent:[0,2,3,9],author:0,ave_spe:0,ave_speed_from:0,ave_speed_to:0,averag:[0,8],bad:0,bearer:0,beta:10,bike:[0,8],bound:0,build:10,by_sport:5,by_tim:5,calcul:7,calendar:[7,8],can:[8,9,10],chang:[9,10],charact:12,chart:[0,8,10],chart_data:0,check:[6,11],client:[10,11],clone:10,code:0,column:12,com:10,config:[10,11],content:0,coordin:10,copi:10,correctli:[7,11],creat:[0,8],creation:8,creation_d:0,current:7,custom:[10,11],cycl:8,dark:10,darkski:8,dashboard:[7,9],data:[0,9,10,12],databas:10,date:[0,8],debian:10,delet:[0,1,4,8],depend:7,desc:0,descent:0,describ:10,detail:[6,7,9],develop:9,displai:[0,7,8,9,10],distanc:[0,7,8],distance_from:0,distance_to:0,document:9,doe:0,download:10,durat:[0,7,8],duration_from:0,duration_to:0,edit:[1,8],elev:[0,8,10],email:10,encount:10,end:0,endpoint:[2,6,12],enter:8,environn:11,error:[0,7],even:8,exampl:[0,9,10,11],exist:[0,9,11],exodu:9,fa33f4d996844a5c73ecd1ae24456ab8:0,fals:0,farest:8,featur:9,fetch:10,file:[0,7,8,9,10,11],filter:[7,8],fittracke:10,fix:9,flask:10,flaticon:10,follow:10,forbidden:0,forecast:10,form:0,format:0,former:10,forrunn:9,found:0,freepik:10,fri:0,from:[0,9,10],gener:10,get:[0,1,3,4,5,6],git:10,github:10,gmt:0,gpl:9,gpx:[0,7,8,9,10],gpxpy:10,have:0,header:0,health:6,hike:8,his:8,http:[0,10,11],icon:10,imag:[0,10],improv:9,incorrect:7,info:1,inform:9,initi:[10,11],instal:9,integ:0,intern:0,invalid:0,issu:[9,10],jan:0,javascript:10,json:[0,12],jul:0,keep:9,kei:[8,10],last:10,leaflet:[0,10],least:0,line:12,linux:10,list:9,local:9,localhost:[10,11],log:[9,10],login:[1,10],logout:1,longest:8,made:[10,11],mai:10,make:10,makefil:[10,11],mandatori:[0,10],map:[0,8,9,10],map_id:0,max:0,max_alt:0,max_spe:0,max_speed_from:0,max_speed_to:0,maxim:0,maximum:8,mean:11,messag:0,min_alt:0,minim:[0,9],mobil:9,modification_d:0,mon:0,montain:8,month:[7,8],more:9,morn:0,move:[0,7],mpwoadmin:10,multipart:0,must:8,necessari:10,need:10,network:11,next_act:0,no_gpx:0,note:[0,7,8],now:[8,10],number:0,oauth:0,object:0,one:0,onli:[0,8],open:[9,10],order:0,other:10,outdoor:9,own:9,owner:8,packag:10,page:0,pagin:0,paramet:0,pars:[10,12],password:10,past:10,patch:[0,4],paus:[0,7],payload:0,per:0,per_pag:0,permiss:0,pictur:[1,6],ping:6,png:0,possibl:9,post:[0,1,4],postgresql:10,prerequisit:9,previous_act:0,privai:9,product:9,profil:1,progress:[1,3,4,5,6],proprietari:9,provid:[0,8],python:10,queri:0,react:10,react_app_api_url:11,readi:9,rebuild:11,rechart:[0,10],record:[0,2,7,8,9],record_typ:0,redux:10,regist:[1,10],relat:10,releas:[7,10],repo:10,report:9,request:[0,11],respons:0,run:[8,10],runner:9,samr1:10,search:7,second:0,see:[8,9,10,11],segment:[0,7],serv:10,server:[0,9,10],sever:9,singl:6,sky:10,some:[0,7,10],sort:0,speed:[0,8,10],sport:[0,2,5,8,9,10],sport_id:[0,4],standard:8,start:[0,10],stat:[5,7],staticmap:10,statist:[2,9],statu:0,step:10,still:9,store:9,street:9,string:0,success:0,sun:0,sundai:0,support:[7,8],system:10,tab:11,tar:10,test:10,them:9,thi:[0,7,9,10],thunderforest:10,time:[0,5,8],timezon:7,titl:0,todo:[10,13],token:0,tooltip:7,total:7,track:9,tracker:9,transport:8,troubleshoot:9,type:0,unauthor:0,undefin:11,under:9,unexpect:12,updat:[0,1,4,7,10],upgrad:9,upload:[7,8],user:[0,1,2,3,5,7,8,9,12],user_id:[0,5,6],using:[0,9],valid:0,valu:[0,10],variabl:11,version:9,view:7,virtualenv:10,walk:8,weather:[7,8,10],weather_end:0,weather_start:0,web:9,were:7,wget:10,when:7,with_gpx:0,without:[0,8,9],work:[1,3,4,5,6],workout:9,written:10,www:10,xzf:10,yarn:10,yet:9,you:[0,9],your:9},titles:["Activities","Authentication","API documentation","Records","Sports","Statistics","Users","Change log","Features","FitTrackee","Installation","Administrator","Troubleshooting","User"],titleterms:{"new":7,activ:[0,8],administr:11,api:2,authent:1,bug:7,chang:7,charact:11,close:7,column:11,content:9,dashboard:8,data:11,detail:8,dev:10,document:2,environ:10,featur:[7,8],fittracke:9,fix:7,improv:7,instal:10,issu:7,json:11,line:11,list:8,log:7,minim:7,misc:7,pars:11,prerequisit:10,prod:10,record:3,sport:4,statist:[5,7,8],tabl:9,troubleshoot:12,unexpect:11,upgrad:10,user:[6,13],version:7,workout:8}}) \ No newline at end of file +Search.setIndex({docnames:["api/activities","api/auth","api/index","api/records","api/sports","api/stats","api/users","changelog","features","index","installation","troubleshooting/administrator","troubleshooting/index","troubleshooting/user"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:56},filenames:["api/activities.rst","api/auth.rst","api/index.rst","api/records.rst","api/sports.rst","api/stats.rst","api/users.rst","changelog.md","features.rst","index.rst","installation.rst","troubleshooting/administrator.rst","troubleshooting/index.rst","troubleshooting/user.rst"],objects:{"":{"/api/activities":[0,1,1,"post--api-activities"],"/api/activities/(int:activity_id)":[0,3,1,"patch--api-activities-(int-activity_id)"],"/api/activities/(int:activity_id)/chart_data":[0,0,1,"get--api-activities-(int-activity_id)-chart_data"],"/api/activities/(int:activity_id)/gpx":[0,0,1,"get--api-activities-(int-activity_id)-gpx"],"/api/activities/map/(map_id)":[0,0,1,"get--api-activities-map-(map_id)"],"/api/activities/no_gpx":[0,1,1,"post--api-activities-no_gpx"],"/api/auth/login":[1,1,1,"post--api-auth-login"],"/api/auth/logout":[1,0,1,"get--api-auth-logout"],"/api/auth/picture":[1,1,1,"post--api-auth-picture"],"/api/auth/profile":[1,0,1,"get--api-auth-profile"],"/api/auth/profile/edit":[1,1,1,"post--api-auth-profile-edit"],"/api/auth/register":[1,1,1,"post--api-auth-register"],"/api/ping":[6,0,1,"get--api-ping"],"/api/records":[3,0,1,"get--api-records"],"/api/sports":[4,1,1,"post--api-sports"],"/api/sports/(int:sport_id)":[4,3,1,"patch--api-sports-(int-sport_id)"],"/api/stats/(int:user_id)/by_sport":[5,0,1,"get--api-stats-(int-user_id)-by_sport"],"/api/stats/(int:user_id)/by_time":[5,0,1,"get--api-stats-(int-user_id)-by_time"],"/api/users":[6,0,1,"get--api-users"],"/api/users/(user_id)":[6,0,1,"get--api-users-(user_id)"],"/api/users/(user_id)/picture":[6,0,1,"get--api-users-(user_id)-picture"]}},objnames:{"0":["http","get","HTTP get"],"1":["http","post","HTTP post"],"2":["http","delete","HTTP delete"],"3":["http","patch","HTTP patch"]},objtypes:{"0":"http:get","1":"http:post","2":"http:delete","3":"http:patch"},terms:{"default":0,"export":9,"float":0,"int":[0,4,5],"null":[0,1],"return":0,"static":10,"try":[0,1],NOT:[0,1],Not:[0,1],That:1,The:10,Use:7,accord:9,account:8,acit:0,activ:[2,5,7,9],activity_d:0,activity_id:0,adapt:10,add:[7,8,9],admin:[1,8,10],administr:[0,1,8,9,12],again:[0,1],all:[3,4,6,10],allow:[0,1,9],alpinequest:9,alreadi:1,also:9,android:9,api:[0,1,3,4,5,6,8,9,10,11],app:9,applic:[0,1,9,10],arch:10,archiv:10,ascent:0,auth:[0,1],auth_token:1,auth_user_id:0,authent:[0,2,3,9],author:[0,1],ave_spe:0,ave_speed_from:0,ave_speed_to:0,averag:[0,8],bad:[0,1],bearer:[0,1],beta:10,bike:[0,8],bio:1,biographi:1,birth:1,birth_dat:1,bound:0,build:10,by_sport:5,by_tim:5,calcul:7,calendar:[7,8],can:[8,9,10],chang:[9,10],charact:[1,12],chart:[0,8,10],chart_data:0,check:[6,11],client:[10,11],clone:10,code:[0,1],column:12,com:[1,10],config:[10,11],confirm:1,contact:[0,1],content:[0,1],coordin:10,copi:10,correctli:[7,11],creat:[0,1,8],created_at:1,creation:8,creation_d:0,credenti:1,current:7,custom:[10,11],cycl:8,dark:10,darkski:8,dashboard:[7,9],data:[0,1,9,10,12],databas:10,date:[0,1,8],debian:10,delet:[0,1,4,8],depend:7,desc:0,descent:0,describ:10,detail:[6,7,9],develop:9,displai:[0,7,8,9,10],distanc:[0,7,8],distance_from:0,distance_to:0,document:9,doe:0,don:1,download:10,durat:[0,7,8],duration_from:0,duration_to:0,dure:1,edit:[1,8],elev:[0,8,10],email:[1,10],encount:10,end:0,endpoint:[2,6,12],enter:8,environn:11,error:[0,1,7],europ:1,even:8,exampl:[0,1,9,10,11],exist:[0,1,9,11],exodu:9,extens:[0,1],fa33f4d996844a5c73ecd1ae24456ab8:0,fals:[0,1],farest:8,featur:9,fetch:10,file:[0,1,7,8,9,10,11],filter:[7,8],first:1,first_nam:1,fittracke:10,fix:9,flask:10,flaticon:10,follow:10,forbidden:0,forecast:10,form:[0,1],format:[0,1],former:10,forrunn:9,found:[0,1],freepik:10,fri:0,from:[0,9,10],gener:10,get:[0,1,3,4,5,6],gif:1,git:10,github:10,gmt:[0,1],gpl:9,gpx:[0,7,8,9,10],gpxpy:10,have:0,header:[0,1],health:6,hike:8,his:8,http:[0,1,10,11],icon:10,imag:[0,1,10],improv:9,incorrect:7,info:1,inform:9,initi:[10,11],instal:9,integ:0,intern:[0,1],invalid:[0,1],issu:[9,10],jan:0,javascript:10,jpg:1,json:[0,1,12],jul:[0,1],keep:9,kei:[8,10],last:[1,10],last_nam:1,leaflet:[0,10],least:0,line:12,linux:10,list:9,local:9,localhost:[10,11],locat:1,log:[1,9,10],login:[1,10],logout:1,longest:8,made:[10,11],mai:10,make:10,makefil:[10,11],mandatori:[0,10],map:[0,8,9,10],map_id:0,match:1,max:0,max_alt:0,max_spe:0,max_speed_from:0,max_speed_to:0,maxim:0,maximum:8,mean:11,messag:[0,1],min_alt:0,minim:[0,9],mobil:9,modification_d:0,mon:0,montain:8,month:[7,8],more:9,morn:0,move:[0,7],mpwoadmin:10,multipart:[0,1],must:[1,8],name:1,nb_activ:1,nb_sport:1,necessari:10,need:10,network:11,next_act:0,no_gpx:0,note:[0,7,8],now:[8,10],number:0,oauth:[0,1],object:[0,1],one:0,onli:[0,8],open:[9,10],order:0,other:10,out:1,outdoor:9,own:9,owner:8,packag:10,page:0,pagin:0,paramet:[0,1],pari:1,pars:[10,12],part:[0,1],password:[1,10],password_conf:1,past:10,patch:[0,4],paus:[0,7],payload:[0,1],per:0,per_pag:0,permiss:0,pictur:[1,6],ping:6,pleas:[0,1],png:[0,1],possibl:9,post:[0,1,4],postgresql:10,prerequisit:9,previous_act:0,privai:9,product:9,profil:1,progress:[3,4,5,6],proprietari:9,provid:[0,1,8],python:10,queri:0,react:10,react_app_api_url:11,readi:9,rebuild:11,rechart:[0,10],record:[0,2,7,8,9],record_typ:0,redux:10,regist:[1,10],registr:1,relat:10,releas:[7,10],repo:10,report:9,request:[0,1,11],requir:1,respons:[0,1],run:[8,10],runner:9,sam:1,samr1:10,search:7,second:0,see:[8,9,10,11],segment:[0,7],select:[0,1],serv:10,server:[0,1,9,10],sever:9,singl:6,sky:10,some:[0,7,10],sorri:1,sort:0,speed:[0,8,10],sport:[0,2,5,8,9,10],sport_id:[0,4],standard:8,start:[0,10],stat:[5,7],staticmap:10,statist:[2,9],statu:[0,1],step:10,still:9,store:9,street:9,string:[0,1],success:[0,1],successfulli:1,sun:[0,1],sundai:0,support:[7,8],system:10,tab:11,tar:10,test:10,them:9,thi:[0,7,9,10],thunderforest:10,time:[0,1,5,8],timezon:[1,7],titl:0,todo:[10,13],token:[0,1],tooltip:7,total:7,total_dist:1,total_dur:1,track:9,tracker:9,transport:8,troubleshoot:9,type:[0,1],unauthor:[0,1],undefin:11,under:9,unexpect:12,updat:[0,1,4,7,10],upgrad:9,upload:[7,8],user:[0,1,2,3,5,7,8,9,12],user_id:[0,5,6],usernam:1,using:[0,9],valid:[0,1],valu:[0,10],variabl:11,version:9,view:7,virtualenv:10,walk:8,weather:[7,8,10],weather_end:0,weather_start:0,web:[1,9],were:7,wget:10,when:7,with_gpx:0,without:[0,8,9],work:[3,4,5,6],workout:9,written:10,www:10,xzf:10,yarn:10,yet:9,you:[0,9],your:9,zip:0,zone:1},titles:["Activities","Authentication","API documentation","Records","Sports","Statistics","Users","Change log","Features","FitTrackee","Installation","Administrator","Troubleshooting","User"],titleterms:{"new":7,activ:[0,8],administr:11,api:2,authent:1,bug:7,chang:7,charact:11,close:7,column:11,content:9,dashboard:8,data:11,detail:8,dev:10,document:2,environ:10,featur:[7,8],fittracke:9,fix:7,improv:7,instal:10,issu:7,json:11,line:11,list:8,log:7,minim:7,misc:7,pars:11,prerequisit:10,prod:10,record:3,sport:4,statist:[5,7,8],tabl:9,troubleshoot:12,unexpect:11,upgrad:10,user:[6,13],version:7,workout:8}}) \ No newline at end of file diff --git a/docsrc/source/api/auth.rst b/docsrc/source/api/auth.rst index 265416ca..c5c7dc6e 100644 --- a/docsrc/source/api/auth.rst +++ b/docsrc/source/api/auth.rst @@ -1,8 +1,6 @@ Authentication ############## -work in progress - .. autoflask:: fittrackee_api:create_app() :endpoints: auth.register_user, diff --git a/fittrackee_api/fittrackee_api/activities/activities.py b/fittrackee_api/fittrackee_api/activities/activities.py index 06d9e475..30bc7841 100644 --- a/fittrackee_api/fittrackee_api/activities/activities.py +++ b/fittrackee_api/fittrackee_api/activities/activities.py @@ -638,13 +638,17 @@ def post_activity(auth_user_id): :param integer auth_user_id: authenticate user id - :form file: gpx file + :form file: gpx file (allowed extensions: .gpx, .zip) :form data: sport id and notes (example: ``{"sport_id": 1, "notes": ""}``) :reqheader Authorization: OAuth 2.0 Bearer Token :statuscode 201: activity created - :statuscode 400: invalid payload + :statuscode 400: + - Invalid payload. + - No file part. + - No selected file. + - File extension not allowed. :statuscode 401: invalid token :statuscode 500: @@ -1043,7 +1047,7 @@ def delete_activity(auth_user_id, activity_id): :statuscode 204: activity deleted :statuscode 401: invalid token :statuscode 404: activity not found - :statuscode 500: + :statuscode 500: Error. Please try again or contact the administrator. """ diff --git a/fittrackee_api/fittrackee_api/users/auth.py b/fittrackee_api/fittrackee_api/users/auth.py index 92b5d1e4..b84b608b 100644 --- a/fittrackee_api/fittrackee_api/users/auth.py +++ b/fittrackee_api/fittrackee_api/users/auth.py @@ -15,7 +15,61 @@ auth_blueprint = Blueprint('auth', __name__) @auth_blueprint.route('/auth/register', methods=['POST']) def register_user(): - """ register a user """ + """ + register a user + + **Example request**: + + .. sourcecode:: http + + POST /auth/register HTTP/1.1 + Content-Type: application/json + + **Example responses**: + + - successful registration + + .. sourcecode:: http + + HTTP/1.1 201 CREATED + Content-Type: application/json + + { + "auth_token": "JSON Web Token", + "message": "Successfully registered.", + "status": "success" + } + + - error on registration + + .. sourcecode:: http + + HTTP/1.1 400 BAD REQUEST + Content-Type: application/json + + { + "message": "Errors: Valid email must be provided.\\n", + "status": "error" + } + + :