AcmeCorp Api documentation

Documentation for the REST api access provided at AcmeCorp

User

User | Create a new User

In this case "apiErrorStructure" is defined and used. Define blocks with params that will be used in several functions, so you dont have to rewrite them.

post
https://api.example.com/user

Permission: none

Request Body

Field Type Description
age   required Number

Age of the User

name   required String

Name of the User

Default value: Caroline

extraInfo.hireDate   required Date

Date when user was hired

extraInfo.hireDateWithDefault   required Date

Date when user was hired with default

Default value: 2021-09-01

extraInfo.nickname   required String

Nickname of the user

extraInfo.isVegan   required Boolean

Is the user vegan? (boolean with default)

Default value: true

extraInfo.isAlive   required Boolean

Is the user alive? (boolean with no default)

extraInfo.secrets.crush   required String

The user secret crush

extraInfo.secrets.hair   required Number

Number of hair of user

Default value: 1000

Success 200

Field Type Description
id required Number

The new Users-ID.

Error 4xx

Name Description
NoAccessRight required

Only authenticated Admins can access the data.

UserNameTooShort required

Minimum of 5 characters required.

HTTP/1.1 400 Bad Request
{
  "error": "UserNameTooShort"
}

Send a Sample Request

url

Body

json

User | Create a User

In this case "apiErrorStructure" is defined and used. Define blocks with params that will be used in several functions, so you dont have to rewrite them.

post
https://api.example.com/user

Permission: none

Parameter

Field Type Description
name required String

Name of the User.

Success 200

Field Type Description
id required String

The Users-ID.

Error 4xx

Name Description
NoAccessRight required

Only authenticated Admins can access the data.

UserNameTooShort required

Minimum of 5 characters required.

HTTP/1.1 400 Bad Request
{
  "error": "UserNameTooShort"
}

Send a Sample Request

url

Parameters

json
String

User | Read data of a User

Compare version 0.3.0 with 0.2.0 and you will see the green markers with new items in version 0.3.0 and red markers with removed items since 0.2.0.

get
https://api.example.com/user/:region/:id/:opt

Permission: admin:computer

curl -H "Authorization: token 5f048fe" -i https://api.example.com/user/fr-par/4711
curl -H "Authorization: token 5f048fe" -H "X-Apidoc-Cool-Factor: superbig" -i https://api.example.com/user/de-ber/1337/yep
const client = AcmeCorpApi('5f048fe');
const user = client.getUser(42);
client = AcmeCorpApi.Client(token="5f048fe")
user = client.get_user(42)

Header

Field Type Description
Authorization required String

The token can be generated from your user profile.

X-Apidoc-Cool-Factor required String

Some other header with a default value.

Default value: big

"Authorization: token 5f048fe"

Parameter

Field Type Description
id required Number

User unique ID

region required String

User region

Default value: fr-par

opt optional String

An optional param

Success 200

Field Type Description
id required Number

The Users-ID.

registered required Date

Registration Date.

name required String

Fullname of the User.

nicknames required String[]

List of Users nicknames (Array of Strings).

profile required Object

Profile data (example for an Object)

  age required Number

Users age.

  image required String

Avatar-Image.

options required Object[]

List of Users options (Array of Objects).

  name required String

Option Name.

  value required String

Option Value.

Error 4xx

Name Description
NoAccessRight required

Only authenticated Admins can access the data.

UserNotFound required

The id of the User was not found.

500 Internal Server Error

Name Description
InternalServerError required

The server encountered an internal error

HTTP/1.1 401 Not Authenticated
{
  "error": "NoAccessRight"
}

Send a Sample Request

url

Headers

String
String

Parameters

json
Number
String
String

User | Read data of a User

Here you can describe the function. Multilines are possible.

get
https://api.example.com/user/:id

Permission: admin

Parameter

Field Type Description
id required String

The Users-ID.

Success 200

Field Type Description
id required String

The Users-ID.

name required Date

Fullname of the User.

Error 4xx

Name Description
UserNotFound required

The id of the User was not found.

Send a Sample Request

url

Parameters

json
String

User | Read data of a User

Here you can describe the function. Multilines are possible.

get
https://api.example.com/user/:id

Permission: admin

Parameter

Field Type Description
id required String

The Users-ID.

Success 200

Field Type Description
id required String

The Users-ID.

name required Date

Fullname of the User.

Error 4xx

Name Description
UserNotFound required

The error description text in version 0.1.0.

Send a Sample Request

url

Parameters

json
String

User | Change a User

This function has same errors like POST /user, but errors not defined again, they were included with "apiErrorStructure"

put
https://api.example.com/user/:id

Permission: none

Parameter

Field Type Description
id required Number

id of the user.

Request Body

Field Type Description
name   required String

Name of the User.

avatar   required File

Upload avatar.

Error 4xx

Name Description
NoAccessRight required

Only authenticated Admins can access the data.

UserNameTooShort required

Minimum of 5 characters required.

HTTP/1.1 400 Bad Request
{
  "error": "UserNameTooShort"
}

Send a Sample Request

url

Parameters

json
Number

Body

json

User | Delete user

Be careful! This will remove all the data associated with that user!

delete
https://api.example.com/user/:id

Permission: admin

curl -X DELETE -H "Authorization: token 5f048fe" -i https://api.example.com/user/4711
const client = AcmeCorpApi('5f048fe');
const user = client.deleteUser(42);
client = AcmeCorpApi.Client(token="5f048fe")
user = client.delete_user(42)

Header

Field Type Description
Authorization required String

The token can be generated from your user profile.

"Authorization: token 5f048fe"

Parameter

Field Type Description
id required Number

id of the user.

Success 200

Field Type Description
result required String

ok if everything went fine.

nullableField optional String

This response field is not always there (can be null).

HTTP/1.1 200 OK
{
    "result": "ok"
}

Error 4xx

Name Description
NoAccessRight required

Only authenticated Admins can access the data.

UserNotFound required

The id of the User was not found.

500 Internal Server Error

Name Description
InternalServerError required

The server encountered an internal error.

HTTP/1.1 401 Not Authenticated
{
  "error": "NoAccessRight"
}

Send a Sample Request

url

Headers

String

Parameters

json
Number

User | Thank a user: this is quite a long name indeed

This is here to have a long name in the left menu.

post
https://api.example.com/user/:id

City

City | Create a new city

Create a new city.

post
https://api.example.com/city

Query Parameter(s)

Field Type Description
view   required String

Type of view.

Default value: Aerial

Allowed values: Aerial, Land, Underwater

zoom   required Number

Zoom.

Request Body

Field Type Description
name   required String

Name of the city

Default value: Paris

Send a Sample Request

url

Query Parameters

String
Number

Body

json

Category (official)

Category (official) | Delete a category

Delete a category. Sample request has been disabled here.

delete
https://api.example.com/category
{
  "user": "Sample User",
   "payload": {
     "test": [
       "code": "
         public class HelloWorldTest {
           HelloWorld hw = new HelloWorld();
           @Test
           public void testOkay {
           assertEquals(\"HelloWorld\", hw.getMsg());
         }
      }"
     ]
   }
}

Query Parameter(s)

Field Type Description
id   required Number

Category ID.

Category (official) | Get a category

Get a category. Sample request on example.com here.

get
https://api.example.com/category

Query Parameter(s)

Field Type Description
id   required Number

Category ID.

Send a Sample Request

url

Query Parameters

Number

Generated with apidoc 0.50.2 - Mon Dec 20 2021 02:56:23 GMT+0100 (Central European Standard Time)