Hello,
I am following the guide for accessing the clarizen API. https://success.clarizen.com/hc/en-us/articles/205711828-16-13-REST-API-Guide-Version-2#authentication
Unfortunately I am receiving the following error while trying to authenticate:
{"errorCode":"FileNotFound","message":"File not found: V2.0/services.","referenceId":"2iPRWfmd4Z7kJ9I64GCwJD"}
The API URL I received for the getServerDefintion request is this:
serverLocation : https://apie1.clarizen.com/v2.0/services
appLocation : https://eu1.clarizen.com/Clarizen
organizationId : 0
If I try to access the url https://apie1.clarizen.com/v2.0/services from the browser I also get the "File not found" Error message.
This seems like a general error in your system or am I doing something wrong? I have attached the code I use to access the API.
# general parameters
$Authentication = @{
userName = "thomas.eitler@learnchamp.com"
Password = "********"
}
# get correct api server url
$baseURL = "https://api.clarizen.com"
$getServerDefinitionURI = ($baseURL+"/V2.0/services/authentication/getServerDefinition")
$getServerDefinitionPayload = $Authentication
Try{
$Response = Invoke-WebRequest -Method Post -Uri $getServerDefinitionURI -Body (ConvertTo-Json $getServerDefinitionPayload) -ContentType "application/json" -ErrorAction Stop
}
Catch {
Write-Warning (convertfrom-json $_).errorCode
Write-Warning (convertfrom-json $_).message
}
Finally{
If($Response.statuscode){
Write-Host $Response.statuscode
}
}
$LCAPI_BASEURL = (convertfrom-json $Response.Content).serverlocation
# Authenticate against our api server
$loginURI = $LCAPI_BASEURL+"/V2.0/services/authentication/login"
$loginPayload = $Authentication
Try{
$Response = Invoke-WebRequest -Method Post -Uri $loginURI -Body (ConvertTo-Json $loginPayload) -ContentType "application/json" -ErrorAction Stop
}
Catch {
Write-Warning (convertfrom-json $_).errorCode
Write-Warning (convertfrom-json $_).message
}
Finally{
If($Response.statuscode){
Write-Host $Response.statuscode
}
}
echo (convertfrom-json $Response.Content) | fl *
Thank you for any advice!
Regards,
Thomas