Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 API Call Gets 404 Error
#1
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 samsara.rest 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)
print(create_dispatch_jobs_param)

try: 
    # /fleet/dispatch_jobs/create
    api_response = api_instance.create_fleet_dispatch_jobs(access_token, create_dispatch_jobs_param)
    pprint(api_response)
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:

Error:
python3 post.py {'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!
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  What is the use of call method and when to use it? everyday1 1 112 Jul-14-2019, 01:02 PM
Last Post: ichabod801
  I'm trying to figure out whether this is a method or function call 357mag 2 251 Jul-04-2019, 01:43 AM
Last Post: ichabod801
  call func from dict mcmxl22 3 303 Jun-21-2019, 05:20 AM
Last Post: snippsat
  API call returning list value of 'None' jimbone30 5 297 Jun-14-2019, 07:42 PM
Last Post: jimbone30
  Call a Function contained in a Tuple SamGer 7 352 Jun-14-2019, 05:00 PM
Last Post: ThomasL
  Using VBA to Call a Python script causes error in pyodbc connector pcarra 1 287 Jun-11-2019, 04:14 PM
Last Post: pcarra
  variable call back into an array yamifm0f 3 255 Jun-07-2019, 02:44 PM
Last Post: heiner55
  Why call import twice? Winfried 5 582 May-24-2019, 09:05 AM
Last Post: Winfried
  call dict object result key error lateublegende 2 244 May-15-2019, 01:08 PM
Last Post: lateublegende
  Make bash call my own Python modules Pedroski55 10 596 Apr-22-2019, 04:04 PM
Last Post: snippsat

Forum Jump:


Users browsing this thread: 1 Guest(s)