Git Product home page Git Product logo

Comments (6)

draperunner avatar draperunner commented on May 27, 2024 1

@J3551c9 To get your curl request to work, add the Content-Type: application/json header, and make sure to escape your inner quotes:

curl -X POST -H "et-client-name: justadev-ruterapp" -H 'content-type: application/json' -d ' { "query": "query{trip(from: {place:\"NSR:StopPlace:14115\"}, to: {place: \"NSR:StopPlace:12655\"}, modes:[bus], maximumTransfers:0, numTripPatterns:20) {tripPatterns { startTime endTime walkDistance legs { mode distance line { id publicCode } } } } } "}' https://api.entur.org/journeyplanner/2.0/index/graphql

I will post here when Node support has been added. :)

from sdk.

draperunner avatar draperunner commented on May 27, 2024 1

Version 0.5.0 is now released, which supports Node.js. https://github.com/entur/sdk/releases/tag/v0.5.0

from sdk.

J3551c9 avatar J3551c9 commented on May 27, 2024

I also tryed with curl but I got Error 500

curl -d ' { "query": "query{trip(from: {place:"NSR:StopPlace:14115"}, to: {place: "NSR:StopPlace:12655"}, modes:[bus], maximumTransfers:0, numTripPatterns:20) {tripPatterns { startTime endTime walkDistance legs { mode distance line { id publicCode } } } } } "}' https://api.entur.org/journeyplanner/2.0/index/graphql

<title>Error 500 Server Error</title>

HTTP ERROR 500

Problem accessing /otp/routers/norway/transmodel/index/graphql. Reason:

    Server Error


Powered by Jetty:// 9.4.11.v20180605

from sdk.

draperunner avatar draperunner commented on May 27, 2024

Hi!

In what environment are you running your program? Currently, we only support running in a browser –not in Node.js.

Could you try adding a .catch block and print the actual error that occurs? I suspect the error is ReferenceError: fetch is not defined.

if (fromLocation && toLocation) {
    service.getTripPatterns({
        searchDate: new Date(),
        from: convertLocationToPosition(fromLocation),
        to: convertLocationToPosition(toLocation),
    }).then(console.log) // eslint-disable-line no-console
    .catch(console.error)
}

from sdk.

J3551c9 avatar J3551c9 commented on May 27, 2024

Ohh I see, I was making the call from node.
I also tried Curl but I got Internal Server Error 500

curl -X POST -H "et-client-name: justadev-ruterapp" -d ' { "query": "query{trip(from: {place:"NSR:StopPlace:14115"}, to: {place: "NSR:StopPlace:12655"}, modes:[bus], maximumTransfers:0, numTripPatterns:20) {tripPatterns { startTime endTime walkDistance legs { mode distance line { id publicCode } } } } } "}' https://api.entur.org/journeyplanner/2.0/index/graphql

from sdk.

J3551c9 avatar J3551c9 commented on May 27, 2024

thanks @draperunner

from sdk.

Related Issues (19)

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.