Incredible Developer Experience for

16 Million

Is the total number of professional developers, and every single one of them matters. Help them use your API in their favourite language and get their love back in the form of beautiful applications. Create instant
API portals with developer-friendly features and never lose a developer community to your competitors.

Breaking Changes? Not Any More

APIs and Microservices work great to bridge multiple tiers in distributed software systems. However, reflecting the changes of fast evolving APIs among the connected tiers is a huge drain on productivity and increases the time to market.

APIMatic’s Code-Gen As A Service instantly creates API wrappers after any update, and thus eliminates the manual rework required to integrate the multiple software tiers. This results in more frequent integrations, a shorter time to market, and a great boost in productivity.

Automate with Continuous Delivery & Integration

With APIMATIC, you can easily enable CI/CD for any scale and speed up your development and testing. APIMATIC takes care of the API updates and enables you to release as frequent as you may like. You can also use our Jenkins, CircleCI, Travis and Appveyor ready SDKs to quickly integrate SDK generation within your CI cycle.

See Related: Automate All the Things: How Dude Solutions Saved $20,000 in Development costs using APIMATIC

Advanced API Editor

Describe your APIs without having to write a single line of code or having to first master an API description format. All functions of defining API and code generation settings are done though the editor, so the developers do not miss out any feature if they are using a UI over a text-based format.

Start describing your API with our editor instantly. Its simple and intuitive. Get immediate warnings for validation or syntax errors. Import Curl and JSON. Export the API to a format of your choice.

On-cloud or On-prem

APIMatic is built from the ground up to be flexible. You can access developer experience platform using our secure cloud-based platform, or easily deploy APIMatic in your own datacenter behind your corporate firewall.

16 Million

Is the total number of professional developers, and every single one of them matters. Help them use your API in their favourite language and get their love back in the form of beautiful applications. Create instant API portals with developer-friendly features and never lose a developer community to your competitors.

Breaking Changes? Not Any More

APIs and Microservices work great to bridge multiple tiers in distributed software systems. However, reflecting the changes of fast evolving APIs among the connected tiers is a huge drain on productivity and increases the time to market.

APIMatic’s Code-Gen As A Service instantly creates API wrappers after any update, and thus eliminates the manual rework required to integrate the multiple software tiers. This results in more frequent integrations, a shorter time to market, and a great boost in productivity.

Automate with Continuous Delivery & Integration

With APIMATIC, you can easily enable CI/CD for any scale and speed up your development and testing. APIMATIC takes care of the API updates and enables you to release as frequent as you may like. You can also use our Jenkins, CircleCI, Travis and Appveyor ready SDKs to quickly integrate SDK generation within your CI cycle.

See Related: Automate All the Things: How Dude Solutions Saved $20,000 in Development costs using APIMATIC

Advanced API Editor

Describe your APIs without having to write a single line of code or having to first master an API description format. All functions of defining API and code generation settings are done though the editor, so the developers do not miss out any feature if they are using a UI over a text-based format.

Start describing your API with our editor instantly. Its simple and intuitive. Get immediate warnings for validation or syntax errors. Import Curl and JSON. Export the API to a format of your choice.

On-cloud or On-prem

APIMatic is built from the ground up to be flexible. You can access developer experience platform using our secure cloud-based platform, or easily deploy APIMatic in your own datacenter behind your corporate firewall.

Sample SDK Code: Python

									
def get_products_types(self,
                       latitude,
                       longitude):
    """Does a GET request to /v1/products.
    The Products endpoint returns information about the Uber products
    offered at a given location. The response includes the display name
    and other details about each product, and lists the products in the
    proper display order.
    Args:
        latitude (float): Latitude component of location.
        longitude (float): Longitude component of location.
    Returns:
        ProductCollection: Response from the API.
    Raises:
        APIException: When an error occurs while fetching the data from
            the remote API. This exception includes the HTTP Response
            code, an error message, and the HTTP body that was received in
            the request.
    """

    # Validate required parameters
    self.validate_parameters(latitude=latitude,
                             longitude=longitude)

    # Prepare query URL
    _query_builder = Configuration.base_uri
    _query_builder += '/v1/products'
    _query_url = APIHelper.clean_url(_query_builder)
    _query_parameters = {
        'latitude': latitude,
        'longitude': longitude
    }

    # Prepare headers
    _headers = {
        'accept': 'application/json'
    }

    # Prepare and execute request
    _request = self.http_client.get(_query_url, headers=_headers, query_parameters=_query_parameters)
    OAuth2.apply(_request)
    _context = self.execute_request(_request)

    # Endpoint and global error handling using HTTP status codes.
    if _context.response.status_code == 404:
        return None
    elif _context.response.status_code == 400:
        raise APIException('Malformed request.', _context)
    elif _context.response.status_code == 401:
        raise APIException('Unauthorized the request requires user authentication (not logged in).', _context)
    elif _context.response.status_code == 403:
        raise APIException('Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.', _context)
    elif _context.response.status_code == 406:
        raise APIException('Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc.', _context)
    elif _context.response.status_code == 422:
        raise APIException('Invalid request. The request body is parse-able however with invalid content.', _context)
    elif _context.response.status_code == 429:
        raise APIException('Too Many Requests. Rate limited.', _context)
    elif _context.response.status_code == 500:
        raise APIException('Internal Server Error.', _context)
    self.validate_response(_context)

    # Return appropriate type
    return APIHelper.json_deserialize(_context.response.raw_body, ProductCollection.from_dictionary)
                                            
                                        
									
/**
* The Products endpoint returns information about the Uber products offered at a given location. The
* response includes the display name and other details about each product, and lists the products in
* the proper display order.
*
* @param double $latitude  Latitude component of location.
* @param double $longitude Longitude component of location.
* @return mixed response from the API call
* @throws APIException Thrown if API call fails
*/
public function getProductsTypes(
    $latitude,
    $longitude
) {
    //check that all required arguments are provided
    if (!isset($latitude, $longitude)) {
        throw new \InvalidArgumentException("One or more required arguments were NULL.");
    }
    //the base uri for api requests
    $_queryBuilder = Configuration::$BASEURI;
    
    //prepare query string for API call
    $_queryBuilder = $_queryBuilder.'/v1/products';
    //process optional query parameters
    APIHelper::appendUrlWithQueryParameters($_queryBuilder, array (
        'latitude'  => $latitude,
        'longitude' => $longitude,
    ));
    //validate and preprocess url
    $_queryUrl = APIHelper::cleanUrl($_queryBuilder);
    //prepare headers
    $_headers = array (
        'user-agent'    => 'APIMATIC 2.0',
        'Accept'        => 'application/json',
        'Authorization' => sprintf('Bearer %1$s', Configuration::$oAuthAccessToken)
    );
    //call on-before Http callback
    $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl);
    if ($this->getHttpCallBack() != null) {
        $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
    }
    //and invoke the API call request to fetch the response
    $response = Request::get($_queryUrl, $_headers);
    $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
    $_httpContext = new HttpContext($_httpRequest, $_httpResponse);
    //call on-after Http callback
    if ($this->getHttpCallBack() != null) {
        $this->getHttpCallBack()->callOnAfterRequest($_httpContext);
    }
    //Error handling using HTTP status codes
    if ($response->code == 400) {
        throw new APIException('Malformed request.', $_httpContext);
    }
    if ($response->code == 401) {
        throw new APIException('Unauthorized the request requires user authentication (not logged in).', $_httpContext);
    }
    if ($response->code == 403) {
        throw new APIException('Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.', $_httpContext);
    }
    if ($response->code == 404) {
        throw new APIException('Not found.', $_httpContext);
    }
    if ($response->code == 406) {
        throw new APIException('Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc.', $_httpContext);
    }
    if ($response->code == 422) {
        throw new APIException('Invalid request. The request body is parse-able however with invalid content.', $_httpContext);
    }
    if ($response->code == 429) {
        throw new APIException('Too Many Requests. Rate limited.', $_httpContext);
    }
    if ($response->code == 500) {
        throw new APIException('Internal Server Error.', $_httpContext);
    }
    //handle errors defined at the API level
    $this->validateResponse($_httpResponse, $_httpContext);
    $mapper = $this->getJsonMapper();
    return $mapper->map($response->body, new Models\ProductCollection());
}
                                        
                                        
								
/// <summary>
/// The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order.
/// </summary>
/// <param name="latitude">Required parameter: Latitude component of location.</param>
/// <param name="longitude">Required parameter: Longitude component of location.</param>
/// <return>Returns the Models.ProductCollection response from the API call</return>
public async Task<Models.ProductCollection> GetProductsTypesAsync(double latitude, double longitude)
{
    //the base uri for api requestss
    string _baseUri = Configuration.BaseUri;

    //prepare query string for API call
    StringBuilder _queryBuilder = new StringBuilder(_baseUri);
    _queryBuilder.Append("/v1/products");

    //process optional query parameters
    APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary<string, object>()
    {
        { "latitude", latitude },
        { "longitude", longitude }
    },ArrayDeserializationFormat,ParameterSeparator);


    //validate and preprocess url
    string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

    //append request with appropriate headers and parameters
    var _headers = new Dictionary<string,string>()
    {
        { "user-agent", "APIMATIC 2.0" },
        { "accept", "application/json" }
    };
    _headers.Add("Authorization", string.Format("Bearer {0}", Configuration.OAuthAccessToken));

    //prepare the API call request to fetch the response
    HttpRequest _request = ClientInstance.Get(_queryUrl,_headers);

    //invoke request and get response
    HttpStringResponse _response = (HttpStringResponse) await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);
    HttpContext _context = new HttpContext(_request,_response);

    //Error handling using HTTP status codes

    //return null on 404
    if (_response.StatusCode == 404)
            return null;

    if (_response.StatusCode == 400)
        throw new APIException(@"Malformed request.", _context);

    if (_response.StatusCode == 401)
        throw new APIException(@"Unauthorized the request requires user authentication (not logged in).", _context);

    if (_response.StatusCode == 403)
        throw new APIException(@"Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.", _context);

    if (_response.StatusCode == 406)
        throw new APIException(@"Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc.", _context);

    if (_response.StatusCode == 422)
        throw new APIException(@"Invalid request. The request body is parse-able however with invalid content.", _context);

    if (_response.StatusCode == 429)
        throw new APIException(@"Too Many Requests. Rate limited.", _context);

    if (_response.StatusCode == 500)
        throw new APIException(@"Internal Server Error.", _context);

    //handle errors defined at the API level
    base.ValidateResponse(_response, _context);

    try
    {
        return APIHelper.JsonDeserialize<Models.ProductCollection>(_response.Body);
    }
    catch (Exception _ex)
    {
        throw new APIException("Failed to parse the response: " + _ex.Message, _context);
    }
}
                                    
                                    
								
/**
* The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order.
* @param {double} latitude    Required parameter: Latitude component of location.
* @param {double} longitude    Required parameter: Longitude component of location.
*
* @return {promise<ProductCollection>}
*/
getProductsTypes: function (latitude, longitude) {

    //Create promise to return
    var _deffered = $q.defer();
    
    // validating required parameters
    var _missingArgs = false;
    if (latitude == null || latitude == undefined) {
        _deffered.reject({errorMessage: "The parameter 'latitude' is a required parameter and cannot be null.", errorCode: -1});
        _missingArgs = true;
    } else if (longitude == null || longitude == undefined) {
        _deffered.reject({errorMessage: "The parameter 'longitude' is a required parameter and cannot be null.", errorCode: -1});
        _missingArgs = true;
    }

    if (_missingArgs)
        return _deffered.promise

    //prepare query string for API call
    var _baseUri = Configuration.BASEURI
    var _queryBuilder = _baseUri + "/v1/products";
    
    // Process query parameters
    _queryBuilder = APIHelper.appendUrlWithQueryParameters(_queryBuilder, {
        "latitude": latitude,
        "longitude": longitude
    });

    //validate and preprocess url
    var _queryUrl = APIHelper.cleanUrl(_queryBuilder);
    
    // prepare headers
    var _headers = {
        "accept": "application/json",
        "Authorization": "Bearer " + Configuration.oAuthAccessToken
    };

    // prepare and invoke the API call request to fetch the response
    var _config = {
        method: "GET",
        queryUrl: _queryUrl,
        headers: _headers,
    };
    
    var _response = HttpClient(_config);
    
    //process response
    _response.then(function (_result) {
        var _strResult =_result.body;
        _result.body = new ProductCollection(_strResult);
        _deffered.resolve(_result);
    }, function(_result){
        // Error handling for custom HTTP status codes
        if (_result.code == 404) {
            _deffered.resolve(null);
        } else if (_result.code == 400) {
            _deffered.reject(APIHelper.appendContext({errorMessage: "Malformed request.", errorCode: 400, errorResponse: _result.message}, _result.getContext()));
        } else if (_result.code == 401) {
            _deffered.reject(APIHelper.appendContext({errorMessage: "Unauthorized the request requires user authentication (not logged in).", errorCode: 401, errorResponse: _result.message}, _result.getContext()));
        } else if (_result.code == 403) {
            _deffered.reject(APIHelper.appendContext({errorMessage: "Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.", errorCode: 403, errorResponse: _result.message}, _result.getContext()));
        } else if (_result.code == 406) {
            _deffered.reject(APIHelper.appendContext({errorMessage: "Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc.", errorCode: 406, errorResponse: _result.message}, _result.getContext()));
        } else if (_result.code == 422) {
            _deffered.reject(APIHelper.appendContext({errorMessage: "Invalid request. The request body is parse-able however with invalid content.", errorCode: 422, errorResponse: _result.message}, _result.getContext()));
        } else if (_result.code == 429) {
            _deffered.reject(APIHelper.appendContext({errorMessage: "Too Many Requests. Rate limited.", errorCode: 429, errorResponse: _result.message}, _result.getContext()));
        } else if (_result.code == 500) {
            _deffered.reject(APIHelper.appendContext({errorMessage: "Internal Server Error.", errorCode: 500, errorResponse: _result.message}, _result.getContext()));
        } else {
            _deffered.reject(APIHelper.appendContext({errorMessage:"HTTP Response Not OK", errorCode: _result.code, errorResponse: _result.message}, _result.getContext()));
        }
    });
    
    return _deffered.promise;
}
                                    
                                    
								
# The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order.
# @param [Float] latitude Required parameter: Latitude component of location.
# @param [Float] longitude Required parameter: Longitude component of location.
# @return ProductCollection response from the API call
def get_products_types(latitude,
                       longitude)

    # validate required parameters
    validate_parameters({
      'latitude' => latitude,
      'longitude' => longitude
    })

    # prepare query url
    _query_builder = Configuration.base_uri.dup
    _query_builder << '/v1/products'
    _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
      'latitude' => latitude,
      'longitude' => longitude
    }
    _query_url = APIHelper.clean_url _query_builder

    # prepare headers
    _headers = {
      'accept' => 'application/json'
    }

    # prepare and execute HttpRequest
    _request = @http_client.get _query_url, headers: _headers
    OAuth2.apply(_request)
    _context = execute_request(_request)

    # validate response against endpoint and global error codes
    if _context.response.status_code == 404
      return nil
    elsif _context.response.status_code == 400
      raise APIException.new 'Malformed request.', _context
    elsif _context.response.status_code == 401
      raise APIException.new 'Unauthorized the request requires user authentication (not logged in).', _context
    elsif _context.response.status_code == 403
      raise APIException.new 'Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.', _context
    elsif _context.response.status_code == 406
      raise APIException.new 'Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc.', _context
    elsif _context.response.status_code == 422
      raise APIException.new 'Invalid request. The request body is parse-able however with invalid content.', _context
    elsif _context.response.status_code == 429
      raise APIException.new 'Too Many Requests. Rate limited.', _context
    elsif _context.response.status_code == 500
      raise APIException.new 'Internal Server Error.', _context
    end
    validate_response(_context)

    # return appropriate response type
    decoded = APIHelper.json_deserialize(_context.response.raw_body)
    return ProductCollection.from_hash(decoded)
end
                                    
                                    
								
/**
* The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order.
* @param    latitude    Required parameter: Latitude component of location.
* @param    longitude    Required parameter: Longitude component of location.
* @return    Returns the void response from the API call 
*/
public void getProductsTypesAsync(
            final double latitude,
            final double longitude,
            final APICallBack<ProductCollection> callBack
) {
    //the base uri for api requests
    String _baseUri = Configuration.baseUri;
    
    //prepare query string for API call
    StringBuilder _queryBuilder = new StringBuilder(_baseUri);
    _queryBuilder.append("/v1/products");

    //process query parameters
    APIHelper.appendUrlWithQueryParameters(_queryBuilder, new HashMap<String, Object>() {
        private static final long serialVersionUID = 5289283514988918434L;
        {
                put( "latitude", latitude );
                put( "longitude", longitude );
        }});
    //validate and preprocess url
    String _queryUrl = APIHelper.cleanUrl(_queryBuilder);

    //load all headers for the outgoing API request
    Map<String, String> _headers = new HashMap<String, String>() {
        private static final long serialVersionUID = 4755840998449492732L;
        {
                put( "user-agent", "APIMATIC 2.0" );
                put( "accept", "application/json" );
                put( "Authorization", String.format("Bearer %1$s", Configuration.oAuthAccessToken) );
        }
    };

    //prepare and invoke the API call request to fetch the response
    final HttpRequest _request = getClientInstance().get(_queryUrl, _headers, null);

    //invoke the callback before request if its not null
    if (getHttpCallBack() != null)
    {
        getHttpCallBack().OnBeforeRequest(_request);
    }

    //invoke request and get response
    Runnable _responseTask = new Runnable() {
        public void run() {
            //make the API call
            getClientInstance().executeAsStringAsync(_request, new APICallBack<HttpResponse>() {
                public void onSuccess(HttpContext _context, HttpResponse _response) {
                    try {

                        //invoke the callback after response if its not null
                        if (getHttpCallBack() != null)	
                        {
                            getHttpCallBack().OnAfterResponse(_context);
                        }

                        //Error handling using HTTP status codes
                        int _responseCode = _response.getStatusCode();
                        if (_responseCode == 400)
                            throw new APIException("Malformed request.", _context);

                        if (_responseCode == 401)
                            throw new APIException("Unauthorized the request requires user authentication (not logged in).", _context);

                        if (_responseCode == 403)
                            throw new APIException("Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.", _context);

                        if (_responseCode == 404)
                            throw new APIException("Not found.", _context);

                        if (_responseCode == 406)
                            throw new APIException("Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc.", _context);

                        if (_responseCode == 422)
                            throw new APIException("Invalid request. The request body is parse-able however with invalid content.", _context);

                        if (_responseCode == 429)
                            throw new APIException("Too Many Requests. Rate limited.", _context);

                        if (_responseCode == 500)
                            throw new APIException("Internal Server Error.", _context);

                        //handle errors defined at the API level
                        validateResponse(_response, _context);

                        //extract result from the http response
                        String _responseBody = ((HttpStringResponse)_response).getBody();
                        ProductCollection _result = APIHelper.deserialize(_responseBody,
                                                    new TypeReference<ProductCollection>(){});

                        //let the caller know of the success
                        callBack.onSuccess(_context, _result);
                    } catch (APIException error) {
                        //let the caller know of the error
                        callBack.onFailure(_context, error);
                    } catch (IOException ioException) {
                        //let the caller know of the caught IO Exception
                        callBack.onFailure(_context, ioException);
                    } catch (Exception exception) {
                        //let the caller know of the caught Exception
                        callBack.onFailure(_context, exception);
                    }
                }
                public void onFailure(HttpContext _context, Throwable _error) {
                    //invoke the callback after response if its not null
                    if (getHttpCallBack() != null)	
                        {
                        getHttpCallBack().OnAfterResponse(_context);
                    }

                    //let the caller know of the failure
                    callBack.onFailure(_context, _error);
                }
            });
        }
    };

    //execute async using thread pool
    APIHelper.getScheduler().execute(_responseTask);
}
                                    
                                    
								

/**
* The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order.
* @param    latitude    Required parameter: Latitude component of location.
* @param    longitude    Required parameter: Longitude component of location.
* @return	Returns the void response from the API call */
- (void) getProductsTypesAsyncWithLatitude:(double) latitude
                longitude:(double) longitude
                completionBlock:(CompletedGetProductsTypes) onCompleted
{
    //the base uri for api requests
    NSString* _baseUri = [NSString stringWithString: (NSString*) Configuration_BaseUri];

    //prepare query string for API call
    NSMutableString* _queryBuilder = [NSMutableString stringWithString: _baseUri]; 
    [_queryBuilder appendString: @"/v1/products"];

    //process optional query parameters
    [APIHelper appendUrl: _queryBuilder withQueryParameters: @{
                    @"latitude": [NSNumber numberWithDouble: latitude],
                    @"longitude": [NSNumber numberWithDouble: longitude]
                }];

    //validate and preprocess url
    NSString* _queryUrl = [APIHelper cleanUrl: _queryBuilder];

    //preparing request headers
    NSMutableDictionary* _headers = [[NSMutableDictionary alloc] initWithDictionary: @{
        @"user-agent": @"APIMATIC 2.0",
        @"accept": @"application/json",
        @"Authorization": [NSString stringWithFormat:@"Bearer %@", Configuration_OAuthAccessToken]
    }];

    //Remove null values from header collection in order to omit from request
    [APIHelper removeNullValues: _headers];


    //prepare the request and fetch response  
    HttpRequest* _request = [[self clientInstance] get: ^(HttpRequest* _request) 
    { 
        [_request setQueryUrl: _queryUrl]; //set request url        
        [_request setHeaders: _headers]; //set request headers

    }];

    //use the instance of the http client to make the actual call
    [[self clientInstance]
     executeAsString: _request
     success: ^(id _context, HttpResponse *_response) {
         //Error handling using HTTP status codes
         NSError* _statusError = nil;

         //Error handling using HTTP status codes 
         if (_response.statusCode == 400)
             _statusError = [[APIError alloc] initWithReason: @"Malformed request."
                                               andContext:_context];
         else if (_response.statusCode == 401)
             _statusError = [[APIError alloc] initWithReason: @"Unauthorized the request requires user authentication (not logged in)."
                                               andContext:_context];
         else if (_response.statusCode == 403)
             _statusError = [[APIError alloc] initWithReason: @"Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues."
                                               andContext:_context];
         else if (_response.statusCode == 404)
             _statusError = [[APIError alloc] initWithReason: @"Not found."
                                               andContext:_context];
         else if (_response.statusCode == 406)
             _statusError = [[APIError alloc] initWithReason: @"Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc."
                                               andContext:_context];
         else if (_response.statusCode == 422)
             _statusError = [[APIError alloc] initWithReason: @"Invalid request. The request body is parse-able however with invalid content."
                                               andContext:_context];
         else if (_response.statusCode == 429)
             _statusError = [[APIError alloc] initWithReason: @"Too Many Requests. Rate limited."
                                               andContext:_context];
         else if (_response.statusCode == 500)
             _statusError = [[APIError alloc] initWithReason: @"Internal Server Error."
                                               andContext:_context];
         else if((_response.statusCode < 200) || (_response.statusCode > 208)) //[200,208] = HTTP OK
             _statusError = [[APIError alloc] initWithReason: @"HTTP Response Not OK"
                                                  andContext:_context];

         if(_statusError != nil)
         {
             //announce completion with failure due to HTTP status code checking
             onCompleted(NO, _context, nil, _statusError);
         }
         else
         {
             //return _response to API caller
             NSString* _strResult = [(HttpStringResponse*)_response body];
             ProductCollection* _result = (ProductCollection*) [APIHelper jsonDeserialize: _strResult
                toClass: ProductCollection.class];

 
             //announce completion with success
             onCompleted(YES, _context, _result, nil);
         }
     } failure:^(id _context, NSError *_error) {
 
         //announce completion with failure
         onCompleted(NO, _context, nil, _error);
     }];
}
                                    
                                    
								
/**
* The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order.
* @param    latitude    Required parameter: Latitude component of location.
* @param    longitude    Required parameter: Longitude component of location.
* @return    Returns the void response from the API call 
*/
public void getProductsTypesAsync(
            final double latitude,
            final double longitude,
            final APICallBack<ProductCollection> callBack
) {
    //the base uri for api requests
    String _baseUri = Configuration.baseUri;
    
    //prepare query string for API call
    StringBuilder _queryBuilder = new StringBuilder(_baseUri);
    _queryBuilder.append("/v1/products");

    //process query parameters
    APIHelper.appendUrlWithQueryParameters(_queryBuilder, new HashMap<String, Object>() {
        private static final long serialVersionUID = 4844447270626123404L;
        {
                put( "latitude", latitude );
                put( "longitude", longitude );
        }});
    //validate and preprocess url
    String _queryUrl = APIHelper.cleanUrl(_queryBuilder);

    //load all headers for the outgoing API request
    Map<String, String> _headers = new HashMap<String, String>() {
        private static final long serialVersionUID = 4831588752527681041L;
        {
                put( "user-agent", "APIMATIC 2.0" );
                put( "accept", "application/json" );
                put( "Authorization", String.format("Bearer %1$s", Configuration.oAuthAccessToken) );
        }
    };

    //prepare and invoke the API call request to fetch the response
    final HttpRequest _request = getClientInstance().get(_queryUrl, _headers, null);

    //invoke the callback before request if its not null
    if (getHttpCallBack() != null)
    {
        getHttpCallBack().OnBeforeRequest(_request);
    }

    //invoke request and get response
    Runnable _responseTask = new Runnable() {
        public void run() {
            //make the API call
            getClientInstance().executeAsStringAsync(_request, new APICallBack<HttpResponse>() {
                public void onSuccess(HttpContext _context, HttpResponse _response) {
                    try {

                        //invoke the callback after response if its not null
                        if (getHttpCallBack() != null)	
                        {
                            getHttpCallBack().OnAfterResponse(_context);
                        }

                        //Error handling using HTTP status codes
                        int _responseCode = _response.getStatusCode();
                        if (_responseCode == 400)
                            throw new APIException("Malformed request.", _context);

                        if (_responseCode == 401)
                            throw new APIException("Unauthorized the request requires user authentication (not logged in).", _context);

                        if (_responseCode == 403)
                            throw new APIException("Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.", _context);

                        if (_responseCode == 404)
                            throw new APIException("Not found.", _context);

                        if (_responseCode == 406)
                            throw new APIException("Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc.", _context);

                        if (_responseCode == 422)
                            throw new APIException("Invalid request. The request body is parse-able however with invalid content.", _context);

                        if (_responseCode == 429)
                            throw new APIException("Too Many Requests. Rate limited.", _context);

                        if (_responseCode == 500)
                            throw new APIException("Internal Server Error.", _context);

                        //handle errors defined at the API level
                        validateResponse(_response, _context);

                        //extract result from the http response
                        String _responseBody = ((HttpStringResponse)_response).getBody();
                        ProductCollection _result = APIHelper.deserialize(_responseBody,
                                                    new TypeReference<ProductCollection>(){});

                        //let the caller know of the success
                        callBack.onSuccess(_context, _result);
                    } catch (APIException error) {
                        //let the caller know of the error
                        callBack.onFailure(_context, error);
                    } catch (IOException ioException) {
                        //let the caller know of the caught IO Exception
                        callBack.onFailure(_context, ioException);
                    } catch (Exception exception) {
                        //let the caller know of the caught Exception
                        callBack.onFailure(_context, exception);
                    }
                }
                public void onFailure(HttpContext _context, Throwable _error) {
                    //invoke the callback after response if its not null
                    if (getHttpCallBack() != null)	
                        {
                        getHttpCallBack().OnAfterResponse(_context);
                    }

                    //let the caller know of the failure
                    callBack.onFailure(_context, _error);
                }
            });
        }
    };

    //execute async using thread pool
    APIHelper.getScheduler().execute(_responseTask);
}
                                    
                                    
								
/**
* The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order.
* @param    float64        latitude      parameter: Required
* @param    float64        longitude     parameter: Required
* @return	Returns the *models_pkg.ProductCollection response from the API call
*/
func (me *APICLIENT_IMPL) GetProductsTypes (
            latitude float64,
            longitude float64) (*models_pkg.ProductCollection, error) {
        //the base uri for api requests
    _queryBuilder := uberapi_lib.BASEURI;

    //prepare query string for API call
   _queryBuilder = _queryBuilder + "/v1/products"

    //variable to hold errors
    var err error = nil
    //process optional query parameters
    _queryBuilder, err = apihelper_pkg.AppendUrlWithQueryParameters(_queryBuilder, map[string]interface{} {
        "latitude" : latitude,
        "longitude" : longitude,
    })
    if err != nil {
        //error in query param handling
        return nil, err
    }

    //validate and preprocess url
    _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)
    if err != nil {
        //error in url validation or cleaning
        return nil, err
    }

    //prepare headers for the outgoing request
    headers := map[string]interface{} {
        "user-agent" : "APIMATIC 2.0",
        "accept" : "application/json",
    }

    //prepare API request
    _request := unirest.Get(_queryBuilder, headers)
    //and invoke the API call request to fetch the response
    _response, err := unirest.AsString(_request);
    if err != nil {
        //error in API invocation
        return nil, err
    }

    //error handling using HTTP status codes
    if (_response.Code == 400) {
        err = apihelper_pkg.NewAPIError("Malformed request.", _response.Code, _response.RawBody)
    } else if (_response.Code == 401) {
        err = apihelper_pkg.NewAPIError("Unauthorized the request requires user authentication (not logged in).", _response.Code, _response.RawBody)
    } else if (_response.Code == 403) {
        err = apihelper_pkg.NewAPIError("Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.", _response.Code, _response.RawBody)
    } else if (_response.Code == 404) {
        err = apihelper_pkg.NewAPIError("Not found.", _response.Code, _response.RawBody)
    } else if (_response.Code == 406) {
        err = apihelper_pkg.NewAPIError("Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc.", _response.Code, _response.RawBody)
    } else if (_response.Code == 422) {
        err = apihelper_pkg.NewAPIError("Invalid request. The request body is parse-able however with invalid content.", _response.Code, _response.RawBody)
    } else if (_response.Code == 429) {
        err = apihelper_pkg.NewAPIError("Too Many Requests. Rate limited.", _response.Code, _response.RawBody)
    } else if (_response.Code == 500) {
        err = apihelper_pkg.NewAPIError("Internal Server Error.", _response.Code, _response.RawBody)
    } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK
            err = apihelper_pkg.NewAPIError("HTTP Response Not OK", _response.Code, _response.RawBody)
        }
    if(err != nil) {
        //error detected in status code validation
        return nil, err
    }

    //returning the response
    var retVal *models_pkg.ProductCollection = &models_pkg.ProductCollection{}
    err = json.Unmarshal(_response.RawBody, &retVal)

    if err != nil {
        //error in parsing
        return nil, err
    }
    return retVal, nil
}
                                    
                                    

/**
* The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order.
* @param {double} latitude    Required parameter: Latitude component of location.
* @param {double} longitude    Required parameter: Longitude component of location.
* @param {function} callback    Required parameter: Callback function in the form of function(error, response)
*
* @return {ProductCollection}	Returns an instance of ProductCollection type
*/
getProductsTypes: function getProductsTypes(latitude, longitude, callback) {
    // Validating required parameters
    if (latitude === null || latitude === undefined) {
        return callback({errorMessage: "The parameter 'latitude' is a required parameter and cannot be null.", errorCode: -1}, null, null);
    } else if (longitude === null || longitude === undefined) {
        return callback({errorMessage: "The parameter 'longitude' is a required parameter and cannot be null.", errorCode: -1}, null, null);
    }
    // prepare query string for API call;
    var _baseUri = _configuration.BASEURI;

    var _queryBuilder = _baseUri + "/v1/products";

    // Process query parameters
    _queryBuilder = _APIHelper.appendUrlWithQueryParameters(_queryBuilder, {
        "latitude": latitude,
        "longitude": longitude
    });

    // validate and preprocess url
    var _queryUrl = _APIHelper.cleanUrl(_queryBuilder);

    // prepare headers
    var _headers = {
        "accept": "application/json",
        "Authorization": "Bearer " + _configuration.oAuthAccessToken
    };

    // Construct the request
    var _options = {
        queryUrl: _queryUrl,
        method: "GET",
        headers: _headers
    };

    // Build the response processing.
    var cb = function cb(_error, _response, _context) {
        var errorResponse;
        if (_error) {
            errorResponse = _BaseController.validateResponse(_context, "getProductsTypes");
            callback(errorResponse.error, errorResponse.response, errorResponse.context);
        } else if (_response.statusCode >= 200 && _response.statusCode <= 206) {
            var parsed = JSON.parse(_response.body);
            parsed = new _ProductCollection(parsed);
            callback(null, parsed, _context);
        } else if (_response.statusCode === 400) {
            callback({errorMessage: "Malformed request.", errorCode: 400, errorResponse: _response.body}, null, _context);
            return;
        } else if (_response.statusCode === 401) {
            callback({errorMessage: "Unauthorized the request requires user authentication (not logged in).", errorCode: 401, errorResponse: _response.body}, null, _context);
            return;
        } else if (_response.statusCode === 403) {
            callback({errorMessage: "Forbidden. Also used for unauthorized requests such as improper OAuth 2.0 scopes or permissions issues.", errorCode: 403, errorResponse: _response.body}, null, _context);
            return;
        } else if (_response.statusCode === 404) {
            callback(null, null, _context);
            return;
        } else if (_response.statusCode === 406) {
            callback({errorMessage: "Unacceptable content type. Client sent an accepts header for a content type which does not exist on the server. Body includes a list of acceptable content types: ?Unacceptable content type. Request resource as: application/json, etc.", errorCode: 406, errorResponse: _response.body}, null, _context);
            return;
        } else if (_response.statusCode === 422) {
            callback({errorMessage: "Invalid request. The request body is parse-able however with invalid content.", errorCode: 422, errorResponse: _response.body}, null, _context);
            return;
        } else if (_response.statusCode === 429) {
            callback({errorMessage: "Too Many Requests. Rate limited.", errorCode: 429, errorResponse: _response.body}, null, _context);
            return;
        } else if (_response.statusCode === 500) {
            callback({errorMessage: "Internal Server Error.", errorCode: 500, errorResponse: _response.body}, null, _context);
            return;
        } else {
            errorResponse = _BaseController.validateResponse(_context, "getProductsTypes");
            callback(errorResponse.error, errorResponse.response, errorResponse.context);
        }
    };

    _request(_options, cb);
}
                                    
                                    

Improving API adoption using SDKs

Voxbone is a cloud communications (IaaS) company that enables telephony applications in 50+ countries.

« Automating the generation of SDKs is a very cost-efficient way to provide support for the most popular programming languages, especially since we do not have in-house experts in each of the 10 languages. By promoting the use of our SDKs, we were also able to track users and measure adoption for the newer version of API. »

10%
Version 3

90%
Version 2

60%
Version 3

40%
Version 2

read more

Saving $20,000 in Development costs using APIMATIC

Dude Solutions is a leading SaaS provider for operations management solutions recognized for its world class delivery and innovation.

« In 3 months, across the 7 SDKs that we generate, we've been able to save $20,000 in development costs. Additionally, the cost of maintenance is also eliminated because the effort to update the SDK each time the API changes is absorbed as part of the feature's design cost. Furthermore, development time for SDKs for each language went from 1 week to 18 seconds thanks to APIMATIC. »

read more