Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 API Call Gets 404 Error
Trying to leverage an API call to build out a new workflow.
Trying to leverage this API call, which models to this.
Drilling down, it calls fleet dispatch create job which appears to model this.

Unfortunately, what I thought was right is giving me a 404 error. I've put * in the code for the API key, group ID (it's an int) and also the vehicle ID (it's an int). Code is as follows:

import time
import samsara
from import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = samsara.FleetApi()
access_token = '*' # str | Samsara API access token.
group_id = *

dispatch_jobs = [{'external_identifier': None}, {'driver_id': None}, {'vehicle_id': *}, {'job_state': None}, {'scheduled_arrival_time_ms': 1561975200000}, {'started_at_ms': 1561968000000}, {'completed_at_ms': None}, {'cancelled_at_ms': None}, {'job_created_at_ms': None}, {'notes': "Your Old House"}, {'destination_name': "Old Home"}, {'destination_address': "3935 41st Ave Dr, Moline, IL 61265"}, {'destination_lat': None}, {'destination_lng': None}]

create_dispatch_jobs_param = samsara.CreateDispatchJobsParam(group_id, dispatch_jobs)

    # /fleet/dispatch_jobs/create
    api_response = api_instance.create_fleet_dispatch_jobs(access_token, create_dispatch_jobs_param)
except ApiException as e:
    print("Exception when calling FleetApi->create_fleet_dispatch_jobs: %s\n" % e)

I've included the call, the print statement above (replaced vehicle and group id with *), and also the error I get:

python3 {'dispatch_jobs': [{'external_identifier': None}, {'driver_id': None}, {'vehicle_id': *}, {'job_state': None}, {'scheduled_arrival_time_ms': 1561975200000}, {'started_at_ms': 1561968000000}, {'completed_at_ms': None}, {'cancelled_at_ms': None}, {'job_created_at_ms': None}, {'notes': 'Your Old House'}, {'destination_name': 'Old Home'}, {'destination_address': '3935 41st Ave Dr, Moline, IL' '61265'}, {'destination_lat': None}, {'destination_lng': None}], 'group_id': *} Exception when calling FleetApi->create_fleet_dispatch_jobs: (404) Reason: Not Found HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 27 Jun 2019 14:45:21 GMT', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '19', 'Connection': 'keep-alive', 'Request-Id': '4878a7dc', 'X-Content-Type-Options': 'nosniff'}) HTTP response body: 404 page not found

Stumped as to why I'm getting the error. Not sure if I'm passing something incorrectly, or missing something. Any suggestions appreciated!

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Using VBA to Call a Python script causes error in pyodbc connector pcarra 1 431 Jun-11-2019, 04:14 PM
Last Post: pcarra
  call dict object result key error lateublegende 2 396 May-15-2019, 01:08 PM
Last Post: lateublegende

Forum Jump:

Users browsing this thread: 1 Guest(s)