Skip to content

Is it possible to Add/Delete User by API? #836

Discussion options

You must be logged in to vote

To use the Web API, you need to provide an auth-token in your HTTP request. Here's an example Python function which takes a JSON body to POST to the graphql endpoint.

def photoview_api_call(body):
    url = "http://127.0.0.1/api/graphql"
    
    headers = {
        "Content-Type": "application/json",
        "Cookie": "auth-token=AAAABBBBCCCC"
    }

    response = requests.post(url, headers=headers, data=body)
    #print(f"API Request: {response.request.body})

    return response

You can get an auth-token by checking what is sent by your web browser however those tokens will expire after a few weeks. For a more permanent solution, edit one of the entries in the access_tokens MySQL tabl…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Zhen-Bo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants