🐈
» Forums » Support » Migrating REST API to GraphQL
Page options
9665ffed
Community Member

Migrating REST API to GraphQL

Hey,
 
I've started to look into the migration to GraphQL API.
 
Some simple endpoints work but the one for getting work diaries for a specific date returns some scopes error.

Rest API endpoint was: /team/v3/workdiaries/companies/{company_id}/{date}

GraphQL basic query:
query workDiaryContract($workDiaryContractInput: WorkDiaryContractInput!) {
workDiaryContract(workDiaryContractInput: $workDiaryContractInput) {
workDiaryMetadata {
timezoneOffset
archivingDateTime
}
}
}

Returns this error:
{'errors': [{'message': "The client or authentication token doesn't have enough oauth2 permissions/scopes to access: [Query.workDiaryContract, WorkDiaryContract.workDiaryMetadata, WorkDiaryMetadata.archivingDateTime, WorkDiaryMetadata.timezoneOffset]. For more information check: https://www.upwork.com/developer/documentation/graphql/api/docs/index.html#getting-started-applicati... document link", 'extensions': {'classification': 'ExecutionAborted'}}]}

My API key permissions includes "View your workdiary".

Could you please help with this?
Thank you,
Eliya
 
19 REPLIES 19
759e32fa
Moderator
Moderator

Hi Eliya,

 

We’ve escalated your community post to a support ticket. One of our agents will be in touch with you soon to assist.


~ AJ
Upwork

Hi - I have been having a heck of a time trying to also get basic workdiaries and financial reports for my Agency and Freelancer accounts of which I am owner of both under the same username/email.

 

Same errors with Oauth2.0 or things like "message

Access to actions:[view_contract] is denied" even though I have confirmed I have added ALL scopes in both REST and GraphQL in my API key admin page. 
 
I even created new API Key request with all scope and still doesn't work.
 
Please someone contact me as I've been trying for over a year now to get this to work. 
0ccaac15
Community Member

Hi - I have been having a heck of a time trying to also get basic workdiaries and financial reports for my Agency and Freelancer accounts of which I am owner of both under the same username/email.

 

Same errors with Oauth2.0 or things like "message

Access to actions:[view_contract] is denied" even though I have confirmed I have added ALL scopes in both REST and GraphQL in my API key admin page. 
 
I even created new API Key request with all scope upfront which was approved. 
 
Please someone contact me as I've been trying for over a year now to get this to work. 

Hi Tal,

 

Thanks for bringing this to our attention. We’ve escalated your community post to a support ticket. One of our agents will be in touch with you soon to assist.

~ Luiggi
Upwork
shozab_sharif
Community Member

Hi Upwork Team

 

We are migrating from REST to GraphQL API and are facing a similar issue while fetching work diaries using Graph API. We are stuck on this point from last one month, please get us in touch with some technical support ASAP, in order to resolve this issue, so that we can move forward.

 

We are trying to get the work diaries per our organisationID which is taken from below query.

 

query {
user {
id
nid
rid
}
organization {
id
name
childOrganizations {
name
}
}
}

 

Query that we are using to get work diaries is as following.

 

query getWorkDiaryCompany($companyId: ID!, $date: String!) {
workDiaryCompany(workDiaryCompanyInput: { companyId: $companyId, date: $date }) {
total
snapshots {
contract {
id
contractTitle
userId
}
user {
id
name
portraitUrl
}
duration
durationInt
task {
id
code
description
memo
}
time {
trackedTime
manualTime
overtime
firstWorked
lastWorked
firstWorkedInt
lastWorkedInt
lastScreenshot
}
screenshots {
activity
screenshotUrl
screenshotImage
screenshotImageLarge
screenshotImageMedium
screenshotImageThumbnail
hasWebcam
hasScreenshot
webcamUrl
webcamImage
webcamImageThumbnail
flags {
hideScreenshot
downSampleScreenshots
}
}
}
}
}

But we are not able to fetch workdiaries for our organization.

 

That query returns an error as below.

"message": "'directoryDSV2', 'GetOrganizationByNid', 'No entity found for parameters : 668108082982662144'",

Can you guide us how can we retrieve the work diaries for our company please?

 

Thank you!

Hi Shozeb,

 

We’ve escalated your community post to a support ticket. One of our agents will be in touch with you soon to assist.

~ Luiggi
Upwork

Did you get a solution from upwork support?  I am receiving the same error and would appreciate hearing about the solution they gave you.

We are trying to call the graphQL query "workDiaryCompany" which requires a company id. The documentation doesn't seem to provide information about where to get company names, or the ids don't seem compatible.  Which api provides the company ids? 

 

First I tried "companySelector" but none of those IDs returned would work:

[{"message":"'directoryDSV2', 'GetOrganizationByNid', 'No entity found for parameters : 425217557184974850'","locations":[{"line":3,"column":9}],"path":["workDiaryCompany"],"extensions":{"code":"16","details":null}}]

 

When I tried usign this example in the documentation it only returns this error:
https://www.upwork.com/developer/documentation/graphql/api/docs/index.html#mapping-list-companies

[{"message":"Validation error (FieldUndefined@[companies]) : Field 'companies' in type 'Query' is undefined","locations":[{"line":3,"column":9}],"extensions":{"classification":"ValidationError"}}]

cambridgecloud_0-1713638181245.png

 

 

 

 

Hi James,

 

Thanks for bringing this to our attention. We’ve escalated your community post to a support ticket. One of our agents will be in touch with you soon to assist.

~ Luiggi
Upwork

Your support ticket link goes to "http://0.15.9.176/" which is not a real address - can you confirm the link to the ticket?

 

 

Hi James,

 

Arjay here stepping in for Luiggi. Please visit your ticket on this page for updates on your report. Don't hesitate to coordinate with the team and they'll gladly assist.

 

~ Arjay
Upwork

Your link still doesn't work.

 

How can I get the company id that i need to provide for accessing the company work log?

 

Hi James,

 

Could you please try clearing your browser's cache and cookies? Then, log back into your account and let us know if the issue persists with a screenshot of what you can see from your end; we'll look further into that for you.

 

~ Arjay
Upwork

I think you do not understand, this is not a browser.  I am using the API through a script in nodejs (or curl) and the api is returning those messages i provided above.  Can you have a technical person on your side review my issue with the linked error messages?

Cookies about your message "link still doesn't work". Moderators here dont care about issue details. Speak via ticket.

You can check your support tickets here https://support.upwork.com/hc/en-us/requests

 

p.s. I wasted lot of time to GraphQL migration. No luck, this trash unusable. No more API here (for my tasks).

They don't respond to ticket either.  They just say they'll help, but when you give them a full gist snippet with examples, they don't respond.

 

I wish they would bring back the rest api because it actually worked.

 

Hi James

No solution yet, they created a support ticket out of my message here, where they are only pointing to API documentation, no specific answer or help provided yet to resolve the issue. REST API has already been deprecated and Graph API not working or no specific help available at least. So our integrations have stopped working and Upwork is not able to help.

I'm having the same experience.  Upwork support has been no help at all and their documentation is flat out wrong...

 

If they ever respond to me, i'll make sure to let you know what solution they provided.  

 

Good luck!

 

I got this api call to work... but i had to ask which value to send via a support case.  They didn't tell me which api returns this value unfortunately.

 

It's the text value from "nid" returned from this api call: 

query user {
user {
nid
}
}
Latest Articles
Featured Topics
Learning Paths