jbloomer / SnipeIT-PythonAPI

Python Interface to the SnipeIT (https://github.com/snipe/snipe-it) API
80 stars 37 forks source link

CreateUserExample #2

Closed Tripowin closed 6 years ago

Tripowin commented 6 years ago

Do u have a "CreateUserExample"?

I will try to edit the python file, and i tell you the result

#!/usr/bin/env python

from snipeit import Users

server=' the url '
token=' API TOKEN'

U = Users()
r = U.create(server, token, "{\"first_name\":\"Miguel\",\"last_name\":\"Cuevas\",\"username\":\"mcuevas\",\"password\":\"Aaaa1231.$\"}")
print r

Regards!!

jbloomer commented 6 years ago

See the UsersPostRequestExample.py. All the POST examples are creates.

The REST API uses the following calls

GET POST PUT DELETE

The Get and GetID examples are GET request POST (create) examples are POST request Update examples are PUT request Delete examples are DELETE request

If you would like more information read up on HTTP methods, https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

jbloomer commented 6 years ago

@TheKrakenPriest did my post above help?

Tripowin commented 6 years ago

Totally my friend! Im a newbie on python, your comments have been very helpful! Regards!