You are viewing limited content. For full access, please sign in.

Question

Question

Laserfiche On-Prem API says that my username is missing in the request

asked on June 6, 2023

The instructions for authenticating are the following

I created a test workflow request as such

But it responds with this error that my username is missing.

It works in the swagger playground, but not in a real http request.

0 0

Answer

SELECTED ANSWER
replied on June 6, 2023

For this API, the content type of the request body is application/x-www-form-urlencoded, rather than application/json. 

 

If you try setting the URI in your request to this format

/LFRepositoryAPI/v1/Repositories/{repository-name}/Token

 and the content body in this format with valid credentials

grant_type=password&username={username}&password={password}

then I think the request should work

1 0

Replies

replied on June 6, 2023

Hi,

For this API, the grant_type, username, and password parameters are part of the request body. In your request, could you try moving these parameters from the URI query parameter to the request content body?

0 0
replied on June 6, 2023

Just copy the URI data to the body? Wouldn't a body be written in JSON?

&variable=value is URI syntax

0 0
SELECTED ANSWER
replied on June 6, 2023

For this API, the content type of the request body is application/x-www-form-urlencoded, rather than application/json. 

 

If you try setting the URI in your request to this format

/LFRepositoryAPI/v1/Repositories/{repository-name}/Token

 and the content body in this format with valid credentials

grant_type=password&username={username}&password={password}

then I think the request should work

1 0
replied on June 6, 2023

That worked just as you said!

I have never used anything other than JSON in the content body before, I guess that explains why it is a post and not a get.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.