cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GraphQL & RESTAPI won't work in Async mode - "Message": "HopexSessionToken is empty" or error

RGenin
Trusted Contributor

Hello, 

 

I have a problem with the Async method of the REST APIs.

Every time I try to execute it, I have a RESTAPI - "Message": "HopexSessionToken is empty".

 

Get Repos will work (so RestAPI config is fine) :

{{server_url}}/hopexapi/restapi/v1/environments/{{environmentId}}/repositories

RGenin_0-1595018275659.png

All others won't work

{{server_url}}/hopexapi/restapi/v2/environments/{{environmentId}}/repositories/{{RepositoryId}}/profiles/{{ProfileId}}/datasets/{{datasetId}}/syncexport

 

{{server_url}}/hopexapi/restapi/v1/environments/{{environmentId}}/repositories/{{RepositoryId}}/profiles/{{ProfileId}}/syncexport

 

RGenin_1-1595018354295.png

 

Same problem arrises if using async method with GraphQl

 

Will work :

RGenin_4-1595018579756.png

 

Won't work:

RGenin_3-1595018552577.png

 

Would you have any idea what would cause that ?

 

Tested in V3C4

 

Thanks !

 

2 Replies

RGenin
Trusted Contributor

Thank you for the detailed explanation and link.

 

In our case, when testing, we had x-hopex-task and x-hopex-sessiontoken ticked in Postman for our first request, which resulted in the above mentionned errors.

RGenin_0-1595264251737.png

Ticking them off for the first request and re-ticking them solved our issue in our testing.

oguimard
Retired

To have the ASYNC work you need to make at least 2 calls :

  • one to make the request
  • one to get the response.

See some explanation here :

https://community.mega.com/t5/REST-API/Asynchronous-versus-Synchronous-Web-service-call/m-p/21913#M6

 

On the first request there should not be the header with HopexSessionToken.The result of the first request return the value of the session Token.

For the second request you must provide the session token.

 

Have you performed your queries in this order ?