Vridlo/api/vridlo.users: Difference between revisions

From ALT Linux Wiki
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
== vridlo.user.index ==
It allows accessing to a list of users, which are presented in the system. Do not poll this method more than once an hour.
Added into API v1.0.
=== Path ===
/v1/users
=== Methods ===
==== GET ====
Returns a list of users, which are presented in the system. Do not poll this method more than once an hour.
Added into API v1.0.
===== Authentication =====
This method requires NO authentication.
===== Arguments =====
NOTE: Arguments can be provided as arguments along with headers fields.
* '''per_page''' is ''natural '''optional'''''
Number of items to return per page. If this argument is omitted, it defaults to 10. The maximum allowed value is 50.
* '''page''' is ''natural '''optional'''''
The page of results to return. If this argument is omitted, it defaults to 1.
* '''names''' is ''[[Vridlo/types/Name|Name]] array '''mandatory'''''
Name array for the user. It can include first name, last name, nickname, or title.
* '''permissions''' is ''[[Vridlo/types/Permission|Permission]] array '''mandatory'''''
Defines permissions for the account, permissions include the admin, or any other write permission to a model.
* '''descriptions''' is ''[[Vridlo/types/Lorem|Lorem]] array '''optional'''''
Descriptions array of the user, which defined as array of [[Vridlo/types/Lorem|Lorems]].
* '''recitals''' is ''[[Vridlo/types/Recital|Recital]] array '''mandatory'''''
Recitals array for the user or group, it defines all of user or group logins, email, jabber addresses etc.
===== Example Response =====
[
  {
    "id": "1",
    "sign_in_count": "2",
    "current_sign_in_at": "10.11.1970 10:10:10",
    "last_sign_in_at": "10.10.1970 10:10:10",
    "confirmed": true,
    "description": "Info user",
    "names": [
        {
          "kind": "firstname",
          "text": "User",
          "icu_locale": "en_US",
        },
        {
          "kind": "paternal",
          "text": "Batkovicz",
          "icu_locale": "en_US",
        },
        {
          "kind": "lastname",
          "text": "Batkov",
          "icu_locale": "en_US",
        },
        {
          "kind": "nickname",
          "text": "Bublo",
          "icu_locale": "en_US",
        }
    ],
    "recitals": [
      {
          "kind": "email",
          "address": "user@gmail.com",
          "foremost": false
      },
      {
          "kind": "email",
          "address": "user@altlinux.org",
          "foremost": true
      },
      {
          "kind": "login",
          "address": "user",
          "foremost": false
      },
      {
          "kind": "jabber",
          "address": "user@jabber.ru",
          "foremost": false
      },
      {
          "kind": "website",
          "address": "http://user.me",
          "foremost": false
      },
      {
          "kind": "location",
          "address": {
            "x": "37.618448",
            "y": "55.753165",
            "grid": "yandex",
            "titles": {
                text: "Moskva. Kremlin. Senatskij palace",
                icu_locale: "en_US",
            },
          },
          "foremost": false
      }
    ]
  }
]
===== Return Codes =====
* '''200''' (''OK'')
The resource list is accessible. Returned data responds to the current state of the resource list, and reading the list is finished.
* '''206''' (''Partial Content'')
The resource list is accessible. Returned data responds to the current state of the resource list, and reading the list is NOT finished yet.
* '''416''' (''Range Not Satisfiable'')
The resource list is accessible. But data can't be returned since range provided don't match the list boundaries.
* '''422.3''' (''SSL is required'')
SSL is required to access the Vridlo API.
* '''500''' (''Service currently unavailable'')
The requested service is temporarily unavailable.
== vridlo.user.slug ==
== vridlo.user.slug ==


Line 5: Line 134:
=== Path ===
=== Path ===


/v1/users/<slug>
/v1/users/<slug>.json


=== Methods ===
=== Methods ===
Line 18: Line 147:


===== Arguments =====
===== Arguments =====
* '''names''' is ''array of [[Vridlo/type/Name|Name]]'' (Mandatory)
 
  Name array for the user.
* '''names''' is ''[[Vridlo/types/Name|Name]] array '''mandatory'''''
* '''admin''' is ''boolean'' (Optional)
  Name array for the user. It can include first name, last name, nickname, or title.
Is the user admin, the field requires '''superuser''' permission token to user model.
* '''permissions''' is ''[[Vridlo/types/Permission|Permission]] array '''mandatory'''''
* '''description''' is ''string'' (Optional)
Defines permissions for the account, permissions include the admin, or any other write permission to a model.
  Description of the user.
* '''descriptions''' is ''[[Vridlo/types/Lorem|Lorem]] array '''optional'''''
* '''recitals''' is ''array of [[Vridlo/type/Recital|Recital]]'' (Mandatory)
  Descriptions array of the user, which defined as array of [[Vridlo/types/Lorem|Lorems]].
  Recital record array for the user.
* '''recitals''' is ''[[Vridlo/types/Recital|Recital]] array '''mandatory'''''
  Recitals array for the user or group, it defines all of user or group logins, email, jabber addresses etc.


====== Sample request ======
====== Sample request ======
  [
  {
  {
  "admin": false,
   "description": "Info user",
   "description": "Info user",
   "names": [
   "names": [
Line 72: Line 200:
           "y": "55.753165",
           "y": "55.753165",
           "grid": "yandex",
           "grid": "yandex",
           "name": "Moskva. Kremlin. Senatskij palace"
           "titles": {
            text: "Moskva. Kremlin. Senatskij palace",
            icu_locale: "en_US",
          },
       },
       },
       "foremost": false
       "foremost": false
    }
    }
   }
   ]
  }
}
]


===== Example Response =====
===== Example Response =====
Line 84: Line 214:
Good response with created record:
Good response with created record:


  {
{
  "id": 1,
   "sign_in_count": 2,
   "sign_in_count": 0,
   "current_sign_in_at": "",
   "current_sign_in_at": "",
   "last_sign_in_at": "",
   "last_sign_in_at": "",
   "confirmed": false,
   "confirmed": false,
  "admin": false,
   "description": "Info user",
   "description": "Info user",
   "names": [
   "names": [
       {
       {
         "kind": "firstname"
         "kind": "firstname",
         "text": "User"
         "text": "User",
        "icu_locale": "en_US",
       },
       },
       {
       {
         "kind": "paternal"
         "kind": "paternal",
         "text": "Batkovič"
         "text": "Batkovicz",
        "icu_locale": "en_US",
       },
       },
       {
       {
         "kind": "lastname"
         "kind": "lastname",
         "text": "Batkovič"
         "text": "Batkov",
        "icu_locale": "en_US",
       },
       },
       {
       {
         "kind": "nickname"
         "kind": "nickname",
         "text": "Bublo"
         "text": "Bublo",
        "icu_locale": "en_US",
       }
       }
   ],
   ],
Line 124: Line 256:
         "kind": "login",
         "kind": "login",
         "address": "user",
         "address": "user",
        "foremost": false
    },
    {
        "kind": "jabber",
        "address": "user@jabber.ru",
        "foremost": false
    },
    {
        "kind": "website",
        "address": "http://user.me",
         "foremost": false
         "foremost": false
     },
     },
Line 132: Line 274:
           "y": "55.753165",
           "y": "55.753165",
           "grid": "yandex",
           "grid": "yandex",
           "name": "Moskva. Kremlin. Senatskij palace"
           "titles": {
              text: "Moskva. Kremlin. Senatskij palace",
              icu_locale: "en_US",
          },
         },
         },
         "foremost": false
         "foremost": false
     }
     }
   }
   ]
}


Error response ''423'':
Error response ''423'':


  {
{
   "error_code": 3
   "error_code": 3
  }
}


===== Return Codes =====
===== Return Codes =====
Line 177: Line 323:
Good response:
Good response:


  {
{
   "id": "1",
   "id": "1",
   "sign_in_count": "2",
   "sign_in_count": "2",
Line 183: Line 329:
   "last_sign_in_at": "10.10.1970 10:10:10",
   "last_sign_in_at": "10.10.1970 10:10:10",
   "confirmed": true,
   "confirmed": true,
  "admin": false,
   "description": "Info user",
   "description": "Info user",
   "names": [
   "names": [
       {
       {
         "kind": "firstname"
         "kind": "firstname",
         "text": "User"
         "text": "User",
        "icu_locale": "en_US",
       },
       },
       {
       {
         "kind": "paternal"
         "kind": "paternal",
         "text": "Batkovič"
         "text": "Batkovicz",
        "icu_locale": "en_US",
       },
       },
       {
       {
         "kind": "lastname"
         "kind": "lastname",
         "text": "Batkovič"
         "text": "Batkov",
        "icu_locale": "en_US",
       },
       },
       {
       {
         "kind": "nickname"
         "kind": "nickname",
         "text": "Bublo"
         "text": "Bublo",
        "icu_locale": "en_US",
       }
       }
   ],
   ],
Line 235: Line 384:
           "y": "55.753165",
           "y": "55.753165",
           "grid": "yandex",
           "grid": "yandex",
           "name": "Moskva. Kremlin. Senatskij palace"
           "titles": {
              text: "Moskva. Kremlin. Senatskij palace",
              icu_locale: "en_US",
          },
         },
         },
         "foremost": false
         "foremost": false
     }
     }
   }
   ]
}


Error response ''423'':
Error response ''423'':


  {
{
   "error_code": 3
   "error_code": 3
  }
}


===== Return Codes =====
===== Return Codes =====
Line 267: Line 420:
===== Authentication =====
===== Authentication =====


This method requires write authentication with write permission to user model.
This method requires write authentication with '''write''' permission token to user model.


===== Arguments =====
===== Arguments =====
NOTE: Blank fields will be skipped, new array fields will be appended


* id (Mandatory)
* '''names''' is ''array of [[Vridlo/type/Name|Name]]'' (Optional)
Id of the user.
  Name array for the user.
* name (Mandatory)
* '''admin''' is ''boolean'' (Optional)
  Name of the user.
  Is the user admin, the field requires '''superuser''' permission token to user model.
* epoch (Optional)
* '''description''' is ''string'' (Optional)
  Epoch of the user build.
* version (Mandatory)
Version of the user build. Must be valid.
* release (Mandatory)
Release of the user build. Must be valid.
* arch (Mandatory)
Arch of the user build. Must be valid.
* description (Optional)
  Description of the user.
  Description of the user.
* built_at (Mandatory)
* '''recitals''' is ''array of [[Vridlo/type/Recital|Recital]]'' (Optional)
  Rpm Built at time. Must be valid.
  Recital record array for the user.
* group_id (Mandatory)
 
  Group Id which the user is belong to. Must be valid.
====== Sample request ======
* sha (Mandatory)
  {
Sha of user file. Must be valid.
  "description": "Info user",
* size (Mandatory)
  "names": [
Size of the user.
    {
* builder_id (Mandatory)
        "kind": "firstname"
Id of the builder. Must be valid.
        "text": "User"
* src_id (Optional)
        "icu_locale": "en_US",
Id of the source repo. Must be valid if arch is not "src", or blank if arch is "src".
    },
* repo_status (Optional)
    {
  Status of validation the package by a repocop.
        "kind": "paternal"
        "text": "Batkovicz"
        "icu_locale": "en_US",
    },
    {
        "kind": "lastname"
        "text": "Batkov"
        "icu_locale": "en_US",
    },
    {
        "kind": "nickname"
        "text": "Bublo"
        "icu_locale": "en_US",
    }
  ],
  "recitals": [
    {
      "kind": "email",
      "address": "user@gmail.com",
      "foremost": false
    },
    {
      "kind": "email",
      "address": "user@altlinux.org",
      "foremost": true
    },
    {
      "kind": "login",
      "address": "user",
      "foremost": false
    },
    {
      "kind": "location",
        "address": {
          "x": "37.618448",
          "y": "55.753165",
          "grid": "yandex",
          "titles": {
              text: "Moskva. Kremlin. Senatskij palace",
              icu_locale: "en_US",
          },
        },
      "foremost": false
    }
  ]
  }


===== Example Request =====
===== Example Request =====
Line 308: Line 499:
Good response:
Good response:


  [
  {
  {
   "id": "1",
   "id": 100000,
   "sign_in_count": "2",
   "name": "ruby",
   "current_sign_in_at": "10.11.1970 10:10:10",
   "epoch": "1",
   "last_sign_in_at": "10.10.1970 10:10:10",
   "version": "2.5.5",
  "confirmed": true,
   "release": "alt1",
   "description": "Info user",
   "arch": "i586",
   "names": [
   "built_at": "10.10.10 10:10:10",
      {
  "description": "ruby package",
        "kind": "firstname",
  "group_id": 100,
        "text": "User",
  "md5": "236abd7880b4577f2b9470c09fee79d6",
        "icu_locale": "en_US",
  "sha": "4a01982354f6d7cab8d9275e43dc0e4329b1d307",
      },
  "size": "100000",
      {
  "builder_id": 1000,
        "kind": "paternal",
  "src_id": 100000,
        "text": "Batkovicz",
  "repo_status": "skip",
        "icu_locale": "en_US",
  }
      },
  ]
      {
        "kind": "lastname",
        "text": "Batkov",
        "icu_locale": "en_US",
      },
      {
        "kind": "nickname",
        "text": "Bublo",
        "icu_locale": "en_US",
      }
   ],
  "recitals": [
    {
        "kind": "email",
        "address": "user@gmail.com",
        "foremost": false
    },
    {
        "kind": "email",
        "address": "user@altlinux.org",
        "foremost": true
    },
    {
        "kind": "login",
        "address": "user",
        "foremost": false
    },
    {
        "kind": "jabber",
        "address": "user@jabber.ru",
        "foremost": false
    },
    {
        "kind": "website",
        "address": "http://user.me",
        "foremost": false
    },
    {
        "kind": "location",
        "address": {
          "x": "37.618448",
          "y": "55.753165",
          "grid": "yandex",
          "titles": {
              text: "Moskva. Kremlin. Senatskij palace",
              icu_locale: "en_US",
          },
        },
        "foremost": false
    }
  ]
  }


Error response ''423'':
Error response ''423'':


  [
  {
  {
   "error_code": 3
   "error_code": 3
  }
}
]


===== Return Codes =====
===== Return Codes =====
Line 362: Line 602:
===== Authentication =====
===== Authentication =====


This method requires write authentication with write permission to user model.
This method requires write authentication with '''write''' permission token to user model.


===== Arguments =====
===== Arguments =====
Line 372: Line 612:
Good response returning deleted record:
Good response returning deleted record:


  [
  {
  {
   "id": "1",
   "id": 100001,
   "sign_in_count": "2",
   "name": "ruby",
   "current_sign_in_at": "10.11.1970 10:10:10",
   "epoch": "1",
   "last_sign_in_at": "10.10.1970 10:10:10",
   "version": "2.5.5",
   "confirmed": true,
   "release": "alt1",
  "description": "Info user",
   "arch": "src",
   "names": [
   "built_at": "10.10.10 10:10:10",
      {
  "description": "ruby package",
        "kind": "firstname",
  "group_id": 100,
        "text": "User",
  "group_name": "Development/Ruby",
        "icu_locale": "en_US",
  "md5": "236abd7880b4577f2b9470c09fee79d6",
      },
  "sha": "4a01982354f6d7cab8d9275e43dc0e4329b1d307",
      {
  "size": "100000",
        "kind": "paternal",
  "builder_name": "Ruby Builder Bot",
        "text": "Batkovicz",
  "builder_id": 1000,
        "icu_locale": "en_US",
  "repo_status": "skip",
      },
  }
      {
  ]
        "kind": "lastname",
        "text": "Batkov",
        "icu_locale": "en_US",
      },
      {
        "kind": "nickname",
        "text": "Bublo",
        "icu_locale": "en_US",
      }
   ],
  "recitals": [
    {
        "kind": "email",
        "address": "user@gmail.com",
        "foremost": false
    },
    {
        "kind": "email",
        "address": "user@altlinux.org",
        "foremost": true
    },
    {
        "kind": "login",
        "address": "user",
        "foremost": false
    },
    {
        "kind": "jabber",
        "address": "user@jabber.ru",
        "foremost": false
    },
    {
        "kind": "website",
        "address": "http://user.me",
        "foremost": false
    },
    {
        "kind": "location",
        "address": {
          "x": "37.618448",
          "y": "55.753165",
          "grid": "yandex",
          "titles": {
              text: "Moskva. Kremlin. Senatskij palace",
              icu_locale: "en_US",
          },
        },
        "foremost": false
    }
  ]
  }


Error response ''423'':
Error response ''423'':


  [
  {
  {
   "error_code": 3
   "error_code": 3
  }
}
]


===== Return Codes =====
===== Return Codes =====

Latest revision as of 17:34, 5 December 2019

vridlo.user.index

It allows accessing to a list of users, which are presented in the system. Do not poll this method more than once an hour. Added into API v1.0.

Path

/v1/users

Methods

GET

Returns a list of users, which are presented in the system. Do not poll this method more than once an hour. Added into API v1.0.

Authentication

This method requires NO authentication.

Arguments
NOTE: Arguments can be provided as arguments along with headers fields.
  • per_page is natural optional
Number of items to return per page. If this argument is omitted, it defaults to 10. The maximum allowed value is 50.
  • page is natural optional
The page of results to return. If this argument is omitted, it defaults to 1.
  • names is Name array mandatory
Name array for the user. It can include first name, last name, nickname, or title.
Defines permissions for the account, permissions include the admin, or any other write permission to a model.
  • descriptions is Lorem array optional
Descriptions array of the user, which defined as array of Lorems.
  • recitals is Recital array mandatory
Recitals array for the user or group, it defines all of user or group logins, email, jabber addresses etc.
Example Response
[
  {
    "id": "1",
    "sign_in_count": "2",
    "current_sign_in_at": "10.11.1970 10:10:10",
    "last_sign_in_at": "10.10.1970 10:10:10",
    "confirmed": true,
    "description": "Info user",
    "names": [
       {
          "kind": "firstname",
          "text": "User",
          "icu_locale": "en_US",
       },
       {
          "kind": "paternal",
          "text": "Batkovicz",
          "icu_locale": "en_US",
       },
       {
          "kind": "lastname",
          "text": "Batkov",
          "icu_locale": "en_US",
       },
       {
          "kind": "nickname",
          "text": "Bublo",
          "icu_locale": "en_US",
       }
    ],
    "recitals": [
      {
         "kind": "email",
         "address": "user@gmail.com",
         "foremost": false
      },
      {
         "kind": "email",
         "address": "user@altlinux.org",
         "foremost": true
      },
      {
         "kind": "login",
         "address": "user",
         "foremost": false
      },
      {
         "kind": "jabber",
         "address": "user@jabber.ru",
         "foremost": false
      },
      {
         "kind": "website",
         "address": "http://user.me",
         "foremost": false
      },
      {
         "kind": "location",
         "address": {
            "x": "37.618448",
            "y": "55.753165",
            "grid": "yandex",
            "titles": {
               text: "Moskva. Kremlin. Senatskij palace",
               icu_locale: "en_US",
            },
         },
         "foremost": false
      }
    ]
  }
]
Return Codes
  • 200 (OK)
The resource list is accessible. Returned data responds to the current state of the resource list, and reading the list is finished.
  • 206 (Partial Content)
The resource list is accessible. Returned data responds to the current state of the resource list, and reading the list is NOT finished yet.
  • 416 (Range Not Satisfiable)
The resource list is accessible. But data can't be returned since range provided don't match the list boundaries.
  • 422.3 (SSL is required)
SSL is required to access the Vridlo API.
  • 500 (Service currently unavailable)
The requested service is temporarily unavailable.


vridlo.user.slug

This allows accessing to the specified user record by <slug> URI-parameter. Added into API v1.0.

Path

/v1/users/<slug>.json

Methods

POST

Creates the user specified by <slug> URI-parameter using the set of properties passed as form data or get parameter array, and returns state of the created record as JSON.

Authentication

This method requires write authentication with write permission token to user model.

Arguments
  • names is Name array mandatory
Name array for the user. It can include first name, last name, nickname, or title.
Defines permissions for the account, permissions include the admin, or any other write permission to a model.
  • descriptions is Lorem array optional
Descriptions array of the user, which defined as array of Lorems.
  • recitals is Recital array mandatory
Recitals array for the user or group, it defines all of user or group logins, email, jabber addresses etc.
Sample request
{
  "description": "Info user",
  "names": [
    {
       "kind": "firstname"
       "text": "User"
    },
    {
       "kind": "paternal"
       "text": "Batkovič"
    },
    {
       "kind": "lastname"
       "text": "Batkovič"
    },
    {
       "kind": "nickname"
       "text": "Bublo"
    }
  ],
  "recitals": [
   {
      "kind": "email",
      "address": "user@gmail.com",
      "foremost": false
   },
   {
      "kind": "email",
      "address": "user@altlinux.org",
      "foremost": true
   },
   {
      "kind": "login",
      "address": "user",
      "foremost": false
   },
   {
      "kind": "location",
      "address": {
         "x": "37.618448",
         "y": "55.753165",
         "grid": "yandex",
         "titles": {
            text: "Moskva. Kremlin. Senatskij palace",
            icu_locale: "en_US",
         },
      },
      "foremost": false
    }
  ]
}
Example Response

Good response with created record:

{
  "sign_in_count": 2,
  "current_sign_in_at": "",
  "last_sign_in_at": "",
  "confirmed": false,
  "description": "Info user",
  "names": [
     {
        "kind": "firstname",
        "text": "User",
        "icu_locale": "en_US",
     },
     {
        "kind": "paternal",
        "text": "Batkovicz",
        "icu_locale": "en_US",
     },
     {
        "kind": "lastname",
        "text": "Batkov",
        "icu_locale": "en_US",
     },
     {
        "kind": "nickname",
        "text": "Bublo",
        "icu_locale": "en_US",
     }
  ],
  "recitals": [
    {
       "kind": "email",
       "address": "user@gmail.com",
       "foremost": false
    },
    {
       "kind": "email",
       "address": "user@altlinux.org",
       "foremost": true
    },
    {
       "kind": "login",
       "address": "user",
       "foremost": false
    },
    {
       "kind": "jabber",
       "address": "user@jabber.ru",
       "foremost": false
    },
    {
       "kind": "website",
       "address": "http://user.me",
       "foremost": false
    },
    {
       "kind": "location",
       "address": {
          "x": "37.618448",
          "y": "55.753165",
          "grid": "yandex",
          "titles": {
             text: "Moskva. Kremlin. Senatskij palace",
             icu_locale: "en_US",
          },
       },
       "foremost": false
    }
  ]
}

Error response 423:

{
  "error_code": 3
}
Return Codes
  • 200 (OK)
The resource wasn't found, and was created. Returned data responds to the current state of the resource.
  • 422.3 (SSL is required)
SSL is required to access the Vridlo API.
  • 422.5 (Invalid incoming data)
The incoming data is invalid. See details for help.
  • 404 (Not Found)
The record with provided slug is not found.
  • 500 (Internal Server Error)
The Internal Server Error has occurred.

GET

Gets properties of the user specified by <slug> URI-parameter, and returns then as JSON. Do not poll this method more than once an hour.

Authentication

This method requires NO authentication.

Arguments

This method requires NO arguments.

Example Response

Good response:

{
  "id": "1",
  "sign_in_count": "2",
  "current_sign_in_at": "10.11.1970 10:10:10",
  "last_sign_in_at": "10.10.1970 10:10:10",
  "confirmed": true,
  "description": "Info user",
  "names": [
     {
        "kind": "firstname",
        "text": "User",
        "icu_locale": "en_US",
     },
     {
        "kind": "paternal",
        "text": "Batkovicz",
        "icu_locale": "en_US",
     },
     {
        "kind": "lastname",
        "text": "Batkov",
        "icu_locale": "en_US",
     },
     {
        "kind": "nickname",
        "text": "Bublo",
        "icu_locale": "en_US",
     }
  ],
  "recitals": [
    {
       "kind": "email",
       "address": "user@gmail.com",
       "foremost": false
    },
    {
       "kind": "email",
       "address": "user@altlinux.org",
       "foremost": true
    },
    {
       "kind": "login",
       "address": "user",
       "foremost": false
    },
    {
       "kind": "jabber",
       "address": "user@jabber.ru",
       "foremost": false
    },
    {
       "kind": "website",
       "address": "http://user.me",
       "foremost": false
    },
    {
       "kind": "location",
       "address": {
          "x": "37.618448",
          "y": "55.753165",
          "grid": "yandex",
          "titles": {
             text: "Moskva. Kremlin. Senatskij palace",
             icu_locale: "en_US",
          },
       },
       "foremost": false
    }
  ]
}

Error response 423:

{
  "error_code": 3
}
Return Codes
  • 200 (OK)
The resource was found and is accessible. Returned data responds to the current state of the resource.
  • 422.3 (SSL is required)
SSL is required to access the Vridlo API.
  • 404 (Not Found)
The record with provided slug is not found.
  • 500 (Internal Server Error)
The Internal Server Error has occurred.

PUT/PATCH

Sets one or many properties of the user specified by <slug> URI-parameter, and returns updated state as JSON.

Authentication

This method requires write authentication with write permission token to user model.

Arguments

NOTE: Blank fields will be skipped, new array fields will be appended

  • names is array of Name (Optional)
Name array for the user.
  • admin is boolean (Optional)
Is the user admin, the field requires superuser permission token to user model.
  • description is string (Optional)
Description of the user.
  • recitals is array of Recital (Optional)
Recital record array for the user.
Sample request
{
  "description": "Info user",
  "names": [
    {
       "kind": "firstname"
       "text": "User"
       "icu_locale": "en_US",
    },
    {
       "kind": "paternal"
       "text": "Batkovicz"
       "icu_locale": "en_US",
    },
    {
       "kind": "lastname"
       "text": "Batkov"
       "icu_locale": "en_US",
    },
    {
       "kind": "nickname"
       "text": "Bublo"
       "icu_locale": "en_US",
    }
  ],
  "recitals": [
   {
      "kind": "email",
      "address": "user@gmail.com",
      "foremost": false
   },
   {
      "kind": "email",
      "address": "user@altlinux.org",
      "foremost": true
   },
   {
      "kind": "login",
      "address": "user",
      "foremost": false
   },
   {
      "kind": "location",
       "address": {
          "x": "37.618448",
          "y": "55.753165",
          "grid": "yandex",
          "titles": {
             text: "Moskva. Kremlin. Senatskij palace",
             icu_locale: "en_US",
          },
       },
      "foremost": false
    }
  ]
}
Example Request

PUT:/v1/users/ca?name=Core_Assembler

Example Response

Good response:

{
  "id": "1",
  "sign_in_count": "2",
  "current_sign_in_at": "10.11.1970 10:10:10",
  "last_sign_in_at": "10.10.1970 10:10:10",
  "confirmed": true,
  "description": "Info user",
  "names": [
     {
        "kind": "firstname",
        "text": "User",
        "icu_locale": "en_US",
     },
     {
        "kind": "paternal",
        "text": "Batkovicz",
        "icu_locale": "en_US",
     },
     {
        "kind": "lastname",
        "text": "Batkov",
        "icu_locale": "en_US",
     },
     {
        "kind": "nickname",
        "text": "Bublo",
        "icu_locale": "en_US",
     }
  ],
  "recitals": [
    {
       "kind": "email",
       "address": "user@gmail.com",
       "foremost": false
    },
    {
       "kind": "email",
       "address": "user@altlinux.org",
       "foremost": true
    },
    {
       "kind": "login",
       "address": "user",
       "foremost": false
    },
    {
       "kind": "jabber",
       "address": "user@jabber.ru",
       "foremost": false
    },
    {
       "kind": "website",
       "address": "http://user.me",
       "foremost": false
    },
    {
       "kind": "location",
       "address": {
          "x": "37.618448",
          "y": "55.753165",
          "grid": "yandex",
          "titles": {
             text: "Moskva. Kremlin. Senatskij palace",
             icu_locale: "en_US",
          },
       },
       "foremost": false
    }
  ]
}

Error response 423:

{
  "error_code": 3
}
Return Codes
  • 200 (OK)
The resource was found and is accessible. Changes were made on the resource successfully. Returned data responds to the current state of the resource.
  • 204 (No Content)
The resource was found and is accessible. But no changes were made on the resource.
  • 422.3 (SSL is required)
SSL is required to access the Vridlo API.
  • 422.5 (Invalid incoming data)
The incoming data is invalid. See details for help.
  • 404 (Not Found)
The record with provided id/slug is not found.
  • 500 (Internal Server Error)
The Internal Server Error has occurred.

DELETE

Destroys the user specified by <slug> URI-parameter, and returns state of the destroyed record as JSON.

Authentication

This method requires write authentication with write permission token to user model.

Arguments

This method requires NO arguments.

Example Response

Good response returning deleted record:

{
  "id": "1",
  "sign_in_count": "2",
  "current_sign_in_at": "10.11.1970 10:10:10",
  "last_sign_in_at": "10.10.1970 10:10:10",
  "confirmed": true,
  "description": "Info user",
  "names": [
     {
        "kind": "firstname",
        "text": "User",
        "icu_locale": "en_US",
     },
     {
        "kind": "paternal",
        "text": "Batkovicz",
        "icu_locale": "en_US",
     },
     {
        "kind": "lastname",
        "text": "Batkov",
        "icu_locale": "en_US",
     },
     {
        "kind": "nickname",
        "text": "Bublo",
        "icu_locale": "en_US",
     }
  ],
  "recitals": [
    {
       "kind": "email",
       "address": "user@gmail.com",
       "foremost": false
    },
    {
       "kind": "email",
       "address": "user@altlinux.org",
       "foremost": true
    },
    {
       "kind": "login",
       "address": "user",
       "foremost": false
    },
    {
       "kind": "jabber",
       "address": "user@jabber.ru",
       "foremost": false
    },
    {
       "kind": "website",
       "address": "http://user.me",
       "foremost": false
    },
    {
       "kind": "location",
       "address": {
          "x": "37.618448",
          "y": "55.753165",
          "grid": "yandex",
          "titles": {
             text: "Moskva. Kremlin. Senatskij palace",
             icu_locale: "en_US",
          },
       },
       "foremost": false
    }
  ]
}

Error response 423:

{
  "error_code": 3
}
Return Codes
  • 200 (OK)
The resource was found and is accessible, and successfully destroyed. Returned data responds to the state of the destroyed resource.
  • 422.3 (SSL is required)
SSL is required to access the Vridlo API.
  • 404 (Not Found)
The record with provided slug is not found.
  • 500 (Internal Server Error)
The Internal Server Error has occurred.