You are not logged in.
Pages: 1
Hi
i try to create new user by rest API
but i have an issue with user password
user created successfully but a can't login into a portal before setting password in administration console
Imports System.Net
Imports System.IO
Imports System.xml
Imports System.xml.linq
Imports System.Xml.XmlDocument
Imports System.Xml.XPath
Imports Newtonsoft.Json.dll
Public Class JsonGLPIUser
Public input As GLPIUser
End Class
Public Class GLPIUser
Public name As String
Public password As String
Public firstname As String
Public realname As String
Public emails As String
End Class
Public Function gpli_additem (ByVal login As String) As String
Dim uri As String = "https://localhost/glpi/apirest.php/user"
Dim request2 As HttpWebRequest = CType(WebRequest.Create(uri), HttpWebRequest)
request2.Method = "post"
request2.ContentType = "application/json"
request2.Headers("App-Token") = "Sa1hSIAEh4gyiiefJlpbYmAfL3iQEp9sg6lO8l3P"
request2.Headers("Session-Token") = glpi_init()
Dim jsonglpiuser As JsonGLPIUser = New JsonGLPIUser()
Dim newuser As GLPIUser = New GLPIUser()
newuser.name = login
newuser.firstname = "firstname"
newuser.realname = "lastname"
newuser.password = "P@ssw0rd"
newuser.emails = login + "@mail.com"
JsonGLPIUser.input = newuser
Dim jsonglpiuserConverted As String = JsonConvert.SerializeObject(JsonGLPIUser)
Dim userstring As String = jsonglpiuserConverted
Dim postdatabytes As Byte()
postdatabytes = Encoding.UTF8.GetBytes(userstring)
Request2.ContentLength = postdatabytes.Length
Using stream = Request2.GetRequestStream()
stream.Write(postdatabytes, 0, postdatabytes.Length)
End Using
End Function
can't find a problem with setting password for user
Offline
I believe you can find the solution in this tracker https://github.com/glpi-project/glpi/issues
You can mark this threat as [resolved] in subject of your threat. (This is only available edit of the first post.) It is good for users who help others to quickly see which post is still open.
##############################################
GLPI 9.3.3
Offline
Pages: 1