Download your project’s ingredients source code

You can generate a list of all ingredients of a project and download a tar.gz for each ingredient. To download a current list of the ingredients of your project you must:

  1. Download and install the State Tool.
  2. Authenticate your account using the state auth command.
  3. Generate a JSON web token for your project by using the state export jwt command and copy the result.
  4. Open the [GraphQL] (https://platform.activestate.com/sv/buildplanner/graphql) interface.
  5. Click on the Headers button at the bottom of the page and paste in the following:
{
 "Authorization": "Bearer <JWT-from-step-3>"
}
  1. Use the GraphQL interface to send a query. See a sample query below.
  2. Use the query output to download your project’s ingredient source code into your working directory.
  3. Generate a JSON web token for your project by using the state export jwt command and copy the result.
  4. Open the [GraphQL] (https://platform.activestate.com/sv/buildplanner/graphql) interface.
  5. Click on the Headers button at the bottom of the page and paste in the following:
{
 "Authorization": "Bearer <JWT-from-step-3>"
}
  1. Use the GraphQL interface to send a query. See a sample query below.
  2. Use the query output to download your project’s ingredient source code into your working directory.

Using graphQL

Example query:

query slsa {
  project(organization: "<ORG-NAME>", project: "<PROEJECT-NAME>") {
    __typename

query slsa { project(organization: “”, project: “”) { __typename … on Project { commit { … on Commit { build { … on Build { … on Build { nodes { __typename __typename … on Source { nodeId namespace nodeId namespace name url patches { sequenceNumber description content } patches { sequenceNumber description content } } } } } } } } } }


Replace \<ORG-NAME> and \<PROJECT-NAME> with information about your project and run the query. 

For more info on the ActiveState GraphQL API, [click here](https://docs.activestate.com/platform/api/).

## Downloading the ingredient list 

You can download any of the tar/zip files using the State Tool CLI using information from the GraphQL output received in step 4.

```text
curl -v -L -O --header "Authorization: Bearer <JWT_TOKEN>" <FILE_URL>

Replace the <JWT_TOKEN> with the JSON web token generated in step 3. Use the URL of the tar/zip file in the GraphQL output as the <FILE_URL> in the above curl command. This will download the requested file to your current working directory.