Comments (6)
@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.
Version 0.5.0 is now released, which supports Node.js. https://github.com/entur/sdk/releases/tag/v0.5.0
from sdk.
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.
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.
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.
thanks @draperunner
from sdk.
Related Issues (19)
- getDeparturesFromStopPlaces fails with GraphQL exception HOT 3
- Add examples for all methods
- Leg-mode information missing from getTripPatterns docs HOT 1
- Every "Edit page"-link on docs goes to /docs/docs/docs/ HOT 1
- Generate API Reference Website HOT 2
- TypeError on no results in getTripPatterns HOT 2
- Automatic publish
- Enable flow for consumers
- Are the examples outdated? HOT 1
- getStopPlaceDepartures faulty parameters
- findTrips crashes
- Name er ikke required i Location HOT 1
- [v1] Update examples HOT 1
- New ignore fields config implementation for getJourneyPatterns
- Realtime not working for ruter... HOT 2
- New method: getBikeRentalStations
- New method: getNearestPlaces
- Function for getting prices would be convenient. HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.