Code Monkey home page Code Monkey logo

Comments (10)

apulverizer avatar apulverizer commented on June 13, 2024

@bkaplan1 for classic projects, you use the item id of Workforce Project. For offline enabled projects you need the feature service item id. To find offline enabled projects, use a search query like type:"Feature Service" AND typekeywords:"Workforce Project"

from workforce-scripts.

bkaplan1 avatar bkaplan1 commented on June 13, 2024

from workforce-scripts.

apulverizer avatar apulverizer commented on June 13, 2024

@bkaplan1 you can just directly use the parameters in the query parameter, the method parameters are just helpers. For example:

items = gis.content.search(f'type:"Feature Service" AND typekeywords:"Workforce Project" AND owner:{gis.users.me.username}')

Should return all of the offline enabled workforce project items.

from workforce-scripts.

bkaplan1 avatar bkaplan1 commented on June 13, 2024

from workforce-scripts.

apulverizer avatar apulverizer commented on June 13, 2024

@bkaplan1

Is items[1] comparable to fs_item? Or how do I get the feature service ID?

offline_project = workforce.Project(item[1])

This should work, can you check the version of the api you are using:

import arcgis
print(arcgis.__version__)

from workforce-scripts.

bkaplan1 avatar bkaplan1 commented on June 13, 2024

from workforce-scripts.

apulverizer avatar apulverizer commented on June 13, 2024

Okay, you need to update the arcgis library to 1.8.3 pre-release when running in the hosted notebook.
An example is hosted here (notice the top commented out block): https://www.arcgis.com/home/item.html?id=f0488d21719f4decafe317670a56204a#preview

There a multiple examples hosted:
https://www.arcgis.com/home/group.html?id=c1695c0c2f9945a8a7fee7dd106c74ae#overview

from workforce-scripts.

bkaplan1 avatar bkaplan1 commented on June 13, 2024

from workforce-scripts.

apulverizer avatar apulverizer commented on June 13, 2024

@bkaplan1 I dug into this and believe it's a bug in the underlying ArcGIS API for Python. I've opened an internal bug for it.

from workforce-scripts.

apulverizer avatar apulverizer commented on June 13, 2024

@bkaplan1 the authentication issue using OAuth should be resolved in the next update of the Python API. The workforce.Project uses the items gis which should already be using the token. The bug was that some POST requests (when using the OAuth workflow) were not correctly setting the token in the header. I don't think there is any workaround.

I'm closing this since the original issue was resolved. Feel free to re-open or create a new issue if you run into more problems.

from workforce-scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.