createCoupon
ساخت یک کد تخفیف جدید
/v1/coupon
Usage and SDK Samples
curl -X POST -H "Authorization: [[apiKey]]" "https://api.apieco.ir/payping-api/v1/coupon"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CouponApi;
import java.io.File;
import java.util.*;
public class CouponApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: Bearer
ApiKeyAuth Bearer = (ApiKeyAuth) defaultClient.getAuthentication("Bearer");
Bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.setApiKeyPrefix("Token");
// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");
CouponApi apiInstance = new CouponApi();
CouponCreateViewModel body = ; // CouponCreateViewModel | مشخصات کد تخفیف
try {
CodeViewModel result = apiInstance.createCoupon(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CouponApi#createCoupon");
e.printStackTrace();
}
}
}
import io.swagger.client.api.CouponApi;
public class CouponApiExample {
public static void main(String[] args) {
CouponApi apiInstance = new CouponApi();
CouponCreateViewModel body = ; // CouponCreateViewModel | مشخصات کد تخفیف
try {
CodeViewModel result = apiInstance.createCoupon(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CouponApi#createCoupon");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: Bearer)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"Authorization"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"Authorization"];
// Configure OAuth2 access token for authorization: (authentication scheme: oauth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
CouponCreateViewModel *body = ; // مشخصات کد تخفیف (optional)
CouponApi *apiInstance = [[CouponApi alloc] init];
// ساخت یک کد تخفیف جدید
[apiInstance createCouponWith:body
completionHandler: ^(CodeViewModel output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var _ = require('____');
var defaultClient = _.ApiClient.instance;
// Configure API key authorization: Bearer
var Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.apiKeyPrefix['Authorization'] = "Token"
// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = "YOUR ACCESS TOKEN"
var api = new _.CouponApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createCoupon(, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class createCouponExample
{
public void main()
{
// Configure API key authorization: Bearer
Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new CouponApi();
var body = new CouponCreateViewModel(); // CouponCreateViewModel | مشخصات کد تخفیف (optional)
try
{
// ساخت یک کد تخفیف جدید
CodeViewModel result = apiInstance.createCoupon(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CouponApi.createCoupon: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
// Configure OAuth2 access token for authorization: oauth2
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\ApiCouponApi();
$body = ; // CouponCreateViewModel | مشخصات کد تخفیف
try {
$result = $api_instance->createCoupon($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CouponApi->createCoupon: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CouponApi;
# Configure API key authorization: Bearer
$WWW::SwaggerClient::Configuration::api_key->{'Authorization'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'Authorization'} = "Bearer";
# Configure OAuth2 access token for authorization: oauth2
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api_instance = WWW::SwaggerClient::CouponApi->new();
my $body = WWW::SwaggerClient::Object::CouponCreateViewModel->new(); # CouponCreateViewModel | مشخصات کد تخفیف
eval {
my $result = $api_instance->createCoupon(body => $body);
print Dumper($result);
};
if ($@) {
warn "Exception when calling CouponApi->createCoupon: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: Bearer
swagger_client.configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['Authorization'] = 'Bearer'
# Configure OAuth2 access token for authorization: oauth2
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.CouponApi()
body = # CouponCreateViewModel | مشخصات کد تخفیف (optional)
try:
# ساخت یک کد تخفیف جدید
api_response = api_instance.create_coupon(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling CouponApi->createCoupon: %s\n" % e)
Parameters
Name | Description |
---|---|
body |