- All the routes have the prefix "/api".
- The status returns will have the value of : "success" or "error"
- If a validation error happens the code returned will be 422 (Unprocessable Entity) with an array of error validations.
- The A at the begining of declaration means the user has to be authenticated (has to send the authentication token as a bearer token).
- The parameters will be in the form : name_of_the_parameter(validation_rule).
- The returns are returned in case everything worked, it means a 200 code will be returned, if an error happens the framework will handle it by sending the appropriate erro code and message.
- If an authentication errors happens "message": "Unauthenticated." with 401 code will be returned.
- All the data returned by the routes other than status is the value of the key data. (status: success, data: "Rest-of-the-data-or-array-or-object-etc")
- email : must be a valid email (regex).
- string : must be a string.
- max: specifies the max length (max:180 means 180 characters at max).
- min: same as max but for minimum.
- password: minimum 8 letters, must have a number, must have one character in upper case and one in lower.
- int : must be an integer.
- optional : the parameter is not required.
- enum : must be in the enum
- wilaya : must be a valid wilaya code (from 1 to 58).
- array : must be an array
The following are the Json format returned by some entities, whenever a route returns a resource come check its definition here :
AreaResource
- code (string)
- slug (string)
- name (string)
- created_at (timestamp)
- updated_at (timestamp)
- parent (AreaParentResource)
AreaParentResource
- code (string)
- slug (string)
- name (string)
- created_at (timestamp)
- updated_at (timestamp)
- children (array:AreaResource)
FileResource
- url (string)
- name (string)
- downloaded (int)
- seen (int)
UserResource
The authenticable depends on the type of the user (company, expert, office, union){
user : {
email(**string**), daira(**string**), town(**string**), wilaya(**string**), seen(**int** //how many times the profile of the user was consulted)
},
authenticable : {
type(**string**),
If it's a company : slug(string), name(**string**), emails(**array:string**), phones(**array:string**), fax(**array:string**), website(**string**), registry_type(**string**), registry(**string**), legal_form(**string**), nif(**string**), nis(**string**), activity_area(**string**), description(**string**), staff_number(**int**), main_activity(**string**), ceo(**string**), creation_date(**date**), cnas_id(**string**), canos_id(**string**), created_at(**timestamp**), updated_at(**timestamp**).
If it's an expert : slug(**string**), name(**string**), emails(**array:string**), phones(**array:string**), fax(**array:string**), website(**string**), registry_type(**string**), registry(**string**), nif(**string**), nis(**string**), areas(**array:AreaResource**), isTrainer(**bool**), description(**string**), missions_export(**array:string**), missions_quality(**array:string**), cnas_id(**string**), canos_id(**string**), created_at(**timestamp**), updated_at(**timestamp**).
If it's an office : slug(**string**), name(**string**), emails(**array:string**), phones(**array:string**), fax(**array:string**), website(**string**), registry_type(**string**), registry(**string**), legal_form(**string**), nif(**string**), nis(**string**), areas(**array:AreaResource**), description(**string**), staff_number(**int**), ceo(**string**), missions_export(**array:string**), missions_quality(**array:string**), creation_date(**date**), cnas_id(**string**), canos_id(**string**), created_at(**timestamp**), updated_at(**timestamp**).
If it's an union : slug(**string**), name(**string**), emails(**array:string**), phones(**array:string**), fax(**array:string**), website(**string**), approval(**string**), ceo(**string**), description(**string**), created_at(**timestamp**), updated_at(**timestamp**).
}
}EventResource
- slug (string)
- name (string)
- description (string)
- start (datetime)
- end (datetime)
- wilaya (string)
- daira (string)
- town (string)
- organizer (string)
- images (array:string)
- files (array:FileResource)
- poster (UserResource)
- created_at (timestamp)
- updated_at (timestamp)
EventUserResource
- id (int)
- user (UserResource)
- event (EventResource)
ArticleResource
- slug (string)
- title (string)
- content (string)
- images (array:string)
- poster (UserResource)
- created_at (timestamp)
- updated_at (timestamp)
/login
- Method: POST
- Returns:
- status.
- token.
- Parameters :
- email.
- password.
/register
- Method: POST
- Returns:
- status.
- token.
- Parameters:
- email(email).
- password(password).
- wilaya(wilaya).
- daira(string, max:180).
- town(string, max:180).
- name(string, max:180 )
- emails(optional, array, string).
- phones(optional, array, string).
- fax(optional, array, string).
- website(optional, string).
- type(enum: company, expert, union, office)]
Depending on the type the following parameteres will be required :
-
company :
- registry_type(enum: registry, approval).
- registry(string, max:180).
- legal_form(string, max:180).
- nif(string, max:180).
- nis(string, max:180).
- activity_area(int, must be a valid id).
- staff_number(int).
- main_activity(string, max:180).
- ceo(string, max:180).
- creation_date(date).
- description(optional, string, max:1000).
- cnas_id(string, max:180).
- casnos_id(string, max:180)
-
expert :
- registry_type(enum: registry, approval).
- registry(string, max:180).
- nif(string, max:180).
- nis(string, max:180).
- areas(array of int represneting the id of areas).
- description(optional, string, max:1000).
- cnas_id(string, max:180).
- casnos_id(string, max:180)
-
union:
- approval(string, max:180).
- ceo(string, max:180).
- description(optional, string, max:1000).
-
office:
- registry_type(enum: registry, approval).
- registry(string, max:180).
- legal_form(string, max:180).
- nif(string, max:180).
- nis(string, max:180).
- areas(array of int represneting the id of areas).
- staff_number(int).
- ceo(string, max:180).
- creation_date(date).
- description(optional, string, max:1000).
- cnas_id(string, max:180).
- casnos_id(string, max:180)
/refresh A
- Method: POST
- Returns :
- status.
- token.
/logout A
- Method: POST
- Returns :
- status.
/members A
- Method: GET
- Returns :
- status.
- array: UserResouce
- Description: retrieve all the users.
/members/trainers A
- Method: GET
- Returns :
- status.
- array: UserResouce
- Description: retrieve the Experts with isTrainer set to true (les formateurs).
/members/{type} A
- {type} values must be one of : company, expert, office, union.
- Method: GET
- Returns :
- status.
- array: UserResouce
- Description: retrieve all the users of type {type}.
/members/{type}/{slug} A
- {type} values must be one of : company, expert, office, union.
- {slug} is the string that identifies the user.
- Method: GET
- Returns :
- status.
- UserResouce
- Description: return the specific user who is of type {type} and has the slug {slug}.
/members/{type}/{slug} A
- {type} values must be one of : company, expert, office, union.
- {slug} is the string that identifies the user.
- Method: PUT
- Returns :
- status.
- UserResouce.
- Description: update a specific user.
- Parameters: same as register.
/members/{type}/{slug} A
- {type} values must be one of : company, expert, office, union.
- {slug} is the string that identifies the user.
- Method: DELETE
- Returns :
- status.
- Description: delete a specific user.
/members/{type}/{slug}/validate A
- {type} values must be one of : company, expert, office, union.
- {slug} is the string that identifies the user.
- Method: POST
- Returns :
- status.
- Description: validate a specific user (accept).
/areas/parents A
- Method: GET
- Returns :
- status.
- array: AreaParentResource.
- Description: returns an array of all the area parents.
/areas/parents/{slug} A
- {slug}: unique string that identifies the record.
- Method: GET
- Returns :
- status.
- AreaParentResource.
- Description: returns the AreaParent identified by {slug}.
/areas/parents/ A
- Method: POST
- Returns :
- status.
- AreaParentResource.
- Description: creates a new AreaParent.
- Parameters:
- code(int).
- name(string).
Details
/areas/parents/{slug} A
- {slug}: unique string that identifies the record.
- Method: PUT
- Returns:
- status.
- AreaParentResource.
- Description: updates the area parent identified by {slug}.
- Parameters:
- code(int).
- name(string).
/areas/parents/{slug} A
- {slug}: unique string that identifies the record.
- Method: DELETE
- Returns :
- status.
- Description: deletes the area parent identified by {slug}.
/areas/children A
- Method: GET
- Returns :
- status.
- array: AreaResource.
- Description: returns an array of all the areas.
/areas/children/{slug} A
- {slug}: unique string that identifies the record.
- Method: GET
- Returns :
- status.
- AreaResource.
- Description: returns the Area identified by {slug}.
Details
/areas/children/ A
- Method: POST
- Returns :
- status.
- AreaResource.
- Description: creates a new Area.
- Parameters:
- code(int).
- name(string).
Details
/areas/children/{slug} A
- {slug}: unique string that identifies the record.
- Method: PUT
- Returns :
- status.
- AreaResource.
- Description: updates the area identified by {slug}.
- Parameters:
- code(int).
- name(string).
/areas/children/{slug} A
- {slug}: unique string that identifies the record.
- Method: DELETE
- Returns :
- status.
- Description: deletes the area identified by {slug}.
/areas/children/{slug} A
- {slug}: unique string that identifies the record.
- Method: DELETE
- Returns :
- status.
- Description: deletes the area identified by {slug}.
/areas/users/{slug} A
- {slug}: unique string that identifies the area child.
- Method: GET
- Returns :
- status.
- array: UserResource.
- Description: returns all the Experts and Offices in this area.
/events/proposals A
- Method: GET
- Returns :
- status.
- array: EventResource.
- Description: returns all the events that users proposed (that are not yet accepted).
/events A
- Method: POST
- Returns :
- status.
- EventResource.
- Description: creates a new Event.
- Parameters:
- name(string, max:180).
- description(string, max:1000).
- start(datetime).
- end(datetime).
- wilaya(optional, wilaya).
- daira(optional, string, max:180).
- town(optional, string, max:180).
- organizer (optional, string, max:180).
- images (max:30 and 1gb max per image).
- files(optional, max:30 and gb max per image).
- training (bool).
/events/{slug} A
- {slug}: unique string that identifies the record
- Method: PUT
- Returns :
- status.
- EventResource.
- Description: updates the event identified by {slug}.
- Parameters:
- name(string, max:180).
- description(string, max:1000).
- start(datetime).
- end(datetime).
- wilaya(optional, wilaya).
- daira(optional, string, max:180).
- town(optional, string, max:180).
- organizer (optional, string, max:180).
- images (max:30 and 1gb max per image).
- files(optional, max:30 and gb max per image).
- training (bool).
/events/{slug}/close A
- {slug}: unique string that identifies the record
- Method: POST
- Returns :
- status.
- Description: switches the close boolean of the event identified by {slug} (close = !close)
/events/{slug}/archive A
- {slug}: unique string that identifies the record
- Method: POST
- Returns :
- status.
- Description: switches the archive boolean of the event identified by {slug} (archive = !archive)
/events/{slug} A
- {slug}: unique string that identifies the record
- Method: DELETE
- Returns :
- status.
- Description: removes the event identified by {slug}
/events/{slug}/accpet A
- {slug}: unique string that identifies the record
- Method: POST
- Returns :
- status.
- Description: switches the accept boolean of the event identified by {slug} (accept = !accept)
/events/{slug}/register A
- {slug}: unique string that identifies the record
- Method: POST
- Returns :
- status.
- Description: registers user to the registration list of the event identified by {slug}
- If the user is authenticated then no parameters are needed, the authenticated user will be registered.
- If the user isn't authenticated, the following parameters will be required: TODO LATER
/events/{slug}/registration_list A
- {slug}: unique string that identifies the record
- Method: GET
- Returns :
- status.
- array: EventUserResource
- Description: returns the registration list of the event identified by {slug}
/events/{slug}/registration_list/{id} A
- {slug}: unique string that identifies the event record
- {id}: unique identifier that identifies the registration record.
- Method: POST
- Returns :
- status.
- Description: switches the accept boolean of the registration identified by the event slug and registration id (accepted = !accetped)
/events/{slug}/registration_list/{id}} A
- {slug}: unique string that identifies the event record
- {id}: unique identifier that identifies the registration record.
- Method: DELETE
- Returns :
- status.
- Description: removes the registration
/events/
- Method: GET
- Returns :
- status.
- array:EventResource
- Description: returns the list of events (accepted, not closed, not archived)
/events/trainings
- Method: GET
- Returns :
- status.
- array:EventResource
- Description: returns the list of trainings(accepted, not closed and not archived)
/events/{slug}
- Method: GET
- Returns :
- status.
- EventResource
- Description: returns the event identified by {slug}.
/articles A
- Method: POST
- Returns :
- status.
- ArticleResource
- Description: creates a new Article.
- Parameters:
- title(string, max:180).
- content(string, max:1000).
- images (max:30 and 1gb max per image).
/articles/{slug} A
- {slug}: unique string that identifies the record.
- Method: PUT
- Returns :
- status.
- ArticleResource
- Description: updates the Article identified by {slug}
- Parameters:
- title(string, max:180).
- content(string, max:1000).
- images (max:30 and 1gb max per image).
/articles/{slug} A
- {slug}: unique string that identifies the record.
- Method: DELETE
- Returns :
- status.
- Description: removes the Article identified by {slug}
/articles/{slug}/archive A
- {slug}: unique string that identifies the record.
- Method: POST
- Returns :
- status.
- Description: switches the archived boolean of the Article identified by {slug} (archived = !archived)
/articles
- Method: GET
- Returns :
- status.
- array:ArticleResource.
- Description: returns the list of articles (archived = false)
/articles/{slug}
- Method: GET
- Returns :
- status.
- ArticleResource.
- Description: returns the article identified by {slug} (archived = false)