Giter Site home page Giter Site logo

the-hideout / tarkov-api Goto Github PK

View Code? Open in Web Editor NEW
125.0 5.0 15.0 1.25 MB

Community made GraphQL API with real-time data for everything in the Escape from Tarkov game!

Home Page: https://api.tarkov.dev/graphql

License: GNU General Public License v3.0

JavaScript 99.37% Shell 0.63%
api graphql escape-from-tarkov

tarkov-api's Introduction

Tarkov API (Escape from Tarkov) ๐Ÿ’ป

deploy test Discord

This is the main API for tarkov.dev, and was forked from kokarn's Tarkov Tools API.

It's a simple GraphQL API running on Cloudflare workers.

This API powers all of tarkov.dev and other notable projects as well:

What is this? ๐Ÿ’ก

A community made GraphQL API for Escape from Tarkov

  • ๐Ÿ†“ Free
  • ๐Ÿ”จ Easy to use
  • ๐Ÿ“– Open source
  • ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Community driven
  • โšก Ultra fast
  • โฐ Data is constantly updated in real-time

What can I do with this API? โญ

  • View the prices of items
  • Get detailed ammo, armor, and weapon information
  • Fetch flea market data
  • View item weight, slots, etc
  • Calculate barter and hideout profit
  • Determine ergo, armor class, durability, etc for an item
  • Fetch detailed quest information and unlocks
  • View info about crafts and their requirements
  • Find information about in-game bosses
  • Detailed info on medicines, stims, and in-game healing
  • So much more (it would take up this entire page to list everything ๐Ÿ˜ธ)

This API does almost everything you would ever want for EFT!

API Playground ๐ŸŽพ

There is a GraphQL playground for you to use and test out

Link: api.tarkov.dev/

Example Query:

query {
  items {
      id
      name
      shortName
      wikiLink
      iconLink
      updated
  }
}

More examples can be found in our graphql example docs ๐Ÿ“š

Even more examples can be found on our api page on tarkov.dev (includes many programming languages too)

Development ๐Ÿ”จ

Prerequisites:

  • Install Wrangler
  • Run wrangler login - (needed for k/v store and secrets)

You may want to create a .dev.vars file in the main project folder with the following values:

  • CACHE_BASIC_AUTH (used for caching)
  • HTTP_GRAPHQL_SERVER (the address to the dedicated graphql server; must be https and a domain - not an IP address)

Start the API server:

Deployment ๐Ÿš€

If you wish to deploy locally and have permissions to do so, run the following command:

wrangler publish

We don't do this often and generally use GitHub actions to do all of our deployments for us

HTTP Server

There's also an http webserver in the /http folder. It can be run with npm run dev or npm start. To run locally, you need to set the following vars (for local testing, you can use an .env file in the /http folder):

  • CLOUDFLARE_TOKEN (token must have permissions to read the KVs the API uses)
  • CACHE_BASIC_AUTH (used for caching)
  • ENVIRONMENT (either production or dev; determines which KVs are read)
  • PORT (defaults to 8088)

tarkov-api's People

Contributors

austinhodak avatar dependabot[bot] avatar discoded avatar github-actions[bot] avatar grantbirki avatar gyran avatar kokarn avatar nicolagenesin avatar oskarrisberg avatar razzmatazzz avatar shebuka avatar thaddeus avatar the-hideout-combine-prs[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tarkov-api's Issues

HandbookCategories returns duplicate children.

Each child category is returned exactly 275 times.
This issue is not present on equivalent ItemCategories queries.

I've provided two queries highlighting the issue.

  • handbookCategories(offset:3, limit:1) {name, children{name}}
    Returns 550 children (2 categories * 275)

  • handbookCategories(offset:9, limit:1) {name, children{name}}
    Returns 1100 children (4 categories * 275)

Incorrect data being returned in taskRequirements

Hello,

I've encountered an issue where the returned data seems to be incorrect. When sending the following query:

query {
  task(id:"60e71ccb5688f6424c7bfec4"){
    id
    name
    minPlayerLevel
    taskRequirements{
      task{
        name
      }
      status
    }
  }
}

I receive this response:

{
  "data": {
    "task": {
      "id": "60e71ccb5688f6424c7bfec4",
      "name": "Trophies",
      "minPlayerLevel": 55,
      "taskRequirements": [
        {
          "task": {
            "name": "The Cleaner"
          },
          "status": [
            "complete"
          ]
        }
      ]
    }
  }
}

However, the "taskRequirements" data is outdated and should not be present. The only requirement for unlocking the task should be having a level of 55 or higher.

This issue was discovered when my friend and I checked the in-game data and found that, despite not having completed the Task 'The Cleaner', the Task 'Trophies' is available to us.

Please look into this issue and update the data accordingly. Thank you.

Add GPS data for TD maps to API

The TD tarkov maps should be moved under tarkov.dev org control, and migrate the GPS data (and associations with task objectives) to the API.

Inconsistency in price of unavailable items

Currently, for "9x18mm PM RG028 gzh ammo pack (16 pcs)" (as an example), I see this returned:

        "changeLast48h": 0,
        "changeLast48hPercent": 0,
        "lastLowPrice": null,
        "low24hPrice": null,
        "avg24hPrice": 0,
        "high24hPrice": null,

I expect them to be either all 0 or all null, not a mix ๐Ÿ˜… Is there any reason for this that I'm missing?

Currency used for x item

API returns sellFor array where price is shown but not the currency.
Is there any way I can get the currency of x item from response.

Thanks a lot and very nice work :)

Unable to retrieve task objective/item count

Issue

I made an issue in the wrong place: the-hideout/tarkov-dev#855

I understand there was an api overhaul and the Quest schema was replaced with TaskObjective.
However I am unable to query the count of a Task/Quest with simply TaskObjective
I see that there areTaskObjectiveBasic and TaskObjectiveItem schemas but are currently inaccessible on https://api.tarkov.dev/ (as far as I know, I could be mistaken) The Task.objectives is simply a list of TaskObjective i.e [TaskObjective]

I would love to work on this. I'm not too familiar with the code base though so any guidance would be helpful.

Context

On https://api.tarkov.dev/

query {
  tasks {
    id
    name
    }
    objectives {
      id
      type
    	description
      maps {
        normalizedName
      }
      optional
    }
  }
}

Sample quest(an element of tasks.objectives: [TaskObjectives]):

{
        "id": "5967733e86f774602332fc84",
        "name": "Shortage",
        "objectives": [
          {
            "id": "5968edc086f77420d2328014",
            "type": "findItem",
            "description": "Find Salewa first aid kits in raid",
            "maps": [],
            "optional": false
          },
          {
            "id": "59689eb886f7740d137ebfc3",
            "type": "giveItem",
            "description": "Hand over the first aid kits",
            "maps": [],
            "optional": false
          }
        ]
      }

Unable to determine how many Salewa first aid kits are required

Item sellFor field CurrencyItems throwing errors

Whenever I try to get information about the currencyItem of an ItemPrice, where the Vendor is not the flea, I got from the sellFor field of an Item I get this error: No item found with id undefined. It works fine for ItemPrices I got from the buyFor field.

That explanation is quite bad, so I attached a little visualization from my debugger, you can easily test that on the playground as well though. Excuse the bad writing, had to do that with my mouse.

Wherever currencyItem is null the error occurred, this is the case for elements 0-3 of the sellFor list

image

Cloudflare Worker

Currently running on a cloudflare worker. I don't think any further configuration is needed aside from the KV store.

Inconsistent naming convention in ItemCategories Key Mechanical data

Hi there,

I noticed that the naming convention in the Key Mechanical API data is inconsistent with the standard convention used for other items. While other items have spaces between words in the "name" field and hyphens between words in the "normalizedName" field, the Key Mechanical item has no spaces in the "name" field and all letters are in uppercase. This inconsistency may cause confusion and make it difficult to work with the data.

Would it be possible to update the Key Mechanical data to conform to the standard naming convention for consistency and ease of use? This would greatly help in working with the data and prevent confusion.

As English is not my native language, I may not have been able to understand the reason behind this inconsistency. If there is a valid reason for the current naming convention, please let me know so that I can better understand the situation.

Thank you for your attention to this matter. I look forward to your response.

Best regards, Seiju

Feature request: Current game patch endpoint

Feature Description

This is a request to add an endpoint to return the current patch number of the game (i.e. 0.13.5.1.26126) .
A possible source for this is the the Changelog page on the EFT Wiki or from the Tarkov Changes site.

My use case

I'm in the works on creating a site for users to report hideout scav case inputs and returns. I want to be able to track data cross-patches, but be able to filter by certain patch numbers. At this moment, I store the games current minor version (i.e 0.12, 0.13, 0.14), with plans to manually update per patch. It would be preferable to save this value down to the exact patch but it is not feasible to manually record and update this.

I would be open to looking into contributing this endpoint, although I am inexperienced with creating API's in graphql. If someone can guide me to a similar endpoint (if it exists), one which scrapes data from the wiki or tarkov changes, I can give it a shot.

Add failed quests property to Tasks

For tasks where another Task or Tasks are marked as failed when the task is completed, add a property to the Task definition which lists the quests that would be failed. This is currently represented as the "alternatives" property on quests in TD. Additionally, the reputation failure property should be added to represent changes from failures.

'5.45x39mm PPBS gs "Igolnik"' Ammo Issue

When queuing for '5.45x39mm PPBS gs "Igolnik"' the API returns error like it doesn't exist.

My query is:
query = """ query {{ items (name: "5.45x39mm PPBS gs "Igolnik"") {{ properties{{ ...ItemProperties }} name types iconLink wikiLink updated sellFor {{ price vendor {{ name }} }} }} }} fragment ItemProperties on ItemPropertiesAmmo {{ tracer tracerColor damage armorDamage fragmentationChance ricochetChance penetrationChance penetrationPower accuracyModifier recoilModifier initialSpeed lightBleedModifier heavyBleedModifier }} """

Server Status Region

Can you add a region parameter for the server status to check for a specific region?

Error retrieving trader barters.

Barter information can no longer be retrieved via the traders query.
This was likely caused by the addition of Lightkeeper, the first in-raid trader.

Query:
{traders{id, levels{barters{id}}}}

Response:

{
  "errors": [
    {
      "message": "Cannot read properties of undefined (reading 'filter')",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "traders",
        0,
        "levels",
        0,
        "barters"
      ]
    },
    {
      "message": "Cannot read properties of undefined (reading 'filter')",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "traders",
        1,
        "levels",
        0,
        "barters"
      ]
    },
    {
      "message": "Cannot read properties of undefined (reading 'filter')",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "traders",
        2,
        "levels",
        0,
        "barters"
      ]
    },
    {
      "message": "Cannot read properties of undefined (reading 'filter')",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "traders",
        3,
        "levels",
        0,
        "barters"
      ]
    },
    {
      "message": "Cannot read properties of undefined (reading 'filter')",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "traders",
        4,
        "levels",
        0,
        "barters"
      ]
    },
    {
      "message": "Cannot read properties of undefined (reading 'filter')",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "traders",
        5,
        "levels",
        0,
        "barters"
      ]
    },
    {
      "message": "Cannot read properties of undefined (reading 'filter')",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "traders",
        6,
        "levels",
        0,
        "barters"
      ]
    },
    {
      "message": "Cannot read properties of undefined (reading 'filter')",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "traders",
        7,
        "levels",
        0,
        "barters"
      ]
    },
    {
      "message": "Cannot read properties of undefined (reading 'filter')",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "traders",
        8,
        "levels",
        0,
        "barters"
      ]
    }
  ],
  "data": {
    "traders": [
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null
    ]
  }
}

Update GraphQL Deployments

In order to save the project costs, we're moving the GraphQL portion of the API off of Cloudflare Workers, and onto a Virtual Machine. This is due to two compounding factors. The first of which is the end of Stellate's generous open source tier of caching. The second is changes to Cloudflare Workers' pricing model. The end result is significantly higher CPU time in workers, and an increased cost for that CPU time. By moving the highest CPU time to a virtual machine, we can hopefully cut total costs back to similar levels before these factors came into play.

API requests will still go through Cloudflare Workers, however that is primarily to seamlessly transition our current settings like our WAF settings. When an API request is received to the workers, they will check the cache machine for an already-processed result, and fall back to requesting a new result from the API Virtual Machine.

  • Setup express based server for GraphQL API
  • Create Dockerfile and updated CI/CD workflows for deployment
  • Create separate repository to move Cloudflare Worker code to
  • Simplify Cloudflare Worker code to check cache machine, and fall back to Virtual Machine for compute
  • Update environment secrets
  • Automate Virtual Machine initial setup

lang: zh make no effect.

I tried this code:

query {
  items(lang: zh) {
    id,
    name,
    shortName,
    basePrice,
    avg24hPrice
  }
}

But it returns all data with English name, not Chinese name.

Issue with query results: Incorrect kappaRequired value for "Capturing Outposts" task

Hello,

I am experiencing an issue with the query results for the following query.

query {
  tasks{
    name
    kappaRequired
  }
}

The problem is that for the "Capturing Outposts" task, the kappaRequired value is being returned as true instead of false, which is incorrect.

image

Could you please investigate this issue and let me know if there is a fix for it? Thank you.

Cannot retrieve ammo.initialSpeed on pre-wipe explosive ammo.

Cannot retrieve initial speed on the following items.

Name: "20/70 Elephant killer slug"
Error: "Int cannot represent non-integer value: 620.13"
Index: 157

Name: "20/70 Flechetta Plus"
Error: "Int cannot represent non-integer value: 618.02"
Index: 158

Inconsistent Server Status

Don't know why this happens, but when running the bot with this request:

`'''
            query {
                status {
                    currentStatuses {
                        name
                        message
                        statusCode
                    }
                }
            }'''`

from Europe it returns General Server Status as well as in detail statuses, such as website, matchmaking etc... but when running this command from the USA this returns just the Genereal Server Status.
Look at this:
image
I run the first command in Europe and the second command from a server in the USA, and this is the difference. It's not a coding error, the problem is the site doesn't return the full dictionary of servers, but just the General one.
This is the difference from the server response from the USA servers:

`{
  "data": {
    "status": {
      "generalStatus": {
        "message": "N/A",
        "statusCode": "Unstable"
      },
      "currentStatuses": [
        {
          "message": "N/A",
          "statusCode": "Unstable",
          "name": "Global"
        }
      ]
    }
  }
}`

and from the EU servers:

{
  "data": {
    "status": {
      "generalStatus": {
        "message": "",
        "statusCode": "OK"
      },
      "currentStatuses": [
        {
          "message": null,
          "statusCode": "OK",
          "name": "Website"
        },
        {
          "message": null,
          "statusCode": "OK",
          "name": "Forum"
        },
        {
          "message": null,
          "statusCode": "OK",
          "name": "Authentication"
        },
        {
          "message": null,
          "statusCode": "OK",
          "name": "Launcher"
        },
        {
          "message": null,
          "statusCode": "OK",
          "name": "Group lobby"
        },
        {
          "message": null,
          "statusCode": "OK",
          "name": "Trading"
        },
        {
          "message": null,
          "statusCode": "OK",
          "name": "Matchmaking"
        },
        {
          "message": null,
          "statusCode": "OK",
          "name": "Friends and msg."
        },
        {
          "message": null,
          "statusCode": "OK",
          "name": "Inventory operations"
        },
        {
          "message": "",
          "statusCode": "OK",
          "name": "Global"
        }
      ]
    }
  }
}

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.