Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Web Services para Registrar o Modificar Regiones de un País.

Swagger open api macroswagger: '2.0' info: title: "SIFCO_REST_API" version: "1.0" description: "La presente documentación busca detallar los métodos que permite ejecutar este **Web Services**, como es Registrar o Modificar las Regiones de un País en la **Aplicación SIFCO WEB** ." termsOfService: "https://sifco.org/sobre-nosotros/" contact: email: "soporte@sifco.org" license: name: "Apache 2.0" url: "http://www.apache.org/licenses/LICENSE-2.0.html" host: "<SERVER>" schemes: - https - http basePath: /<APPDIR>/rest tags: - name: "TApRegion" externalDocs: description: "Manual SIFCO" url

Web Services para Registrar o Modificar Regiones de un País.

Swagger open api macro
swagger: '2.0'
info:
  title: "SIFCO_REST_API"
  version: "1.0"
  description: "La presente documentación busca detallar los métodos que permite ejecutar este **Web Services**, como es Registrar o Modificar las Regiones de un País en la **Aplicación SIFCO WEB** ."
  termsOfService: "https://sifco.atlassian.net/wiki/x/cgDe"
produces:
  - application/json
pathsorg/sobre-nosotros/"
  contact:
  /TApRegion/{ApPaiCod},{ApRegCod}:     getemail: "soporte@sifco.org"
     tagslicense:
        - TApRegion
      operationIdname: "GetTApRegionApache 2.0"  
    summaryurl: "Consultar las Regiones de un País Registrados en el Sistema"
      parameters:
        - in: header
     http://www.apache.org/licenses/LICENSE-2.0.html"
host: "<SERVER>"
schemes:
  - https
  - http
basePath: /<APPDIR>/rest
tags:
- name: "TApRegion"
  externalDocs:
    description: "Manual SIFCO"
    name: Content-Type
     url: "https://sifco.atlassian.net/wiki/x/cgDe"
produces:
  - application/json
paths:
  /TApRegion/{ApPaiCod},{ApRegCod}:
    typeget:
"string"      tags:
    required: true   - TApRegion
      defaultoperationId: application/json"GetTApRegion"
      summary: "Consultar -las in:Regiones headerde un País Registrados en el Sistema"
      parameters:
        - in: header
          name: AuthorizationContent-Type
          type: "string"
          required: true
          default: OAuthapplication/json
<Access Token>         - in: header
          name: GENEXUS-AGENTAuthorization
          type: "string"
          required: true
          default: SmartDeviceOAuth <Access ApplicationToken>
        - namein: "ApPaiCod"header
          inname: "path"GENEXUS-AGENT
          descriptiontype: "Códigostring"
          required: true
          typedefault: "integer"
          format: "int64" SmartDevice Application
        - name: "ApRegCodApPaiCod"
          in: "path"
          description: "Código División Geográfica"
          required: true
          type: "integer"
          format: "int64"
        - name: "ApRegCod"
  responses:         200:in: "path"
          description: "SuccessfulCódigo División operationGeográfica"
          schemarequired: true
           $reftype: "#/definitions/TApRegioninteger"
        400  format: "int64"
      
  description: "Bad request"  responses:
        schema:
            $ref: "#/definitions/GxJsonError"
        401200:
          description: "NotSuccessful Authenticatedoperation"
          schema:
            $ref: "#/definitions/GxJsonErrorTApRegion"
        404400:
          description: "Data with the specified key could not be foundBad request"
          schema:
            $ref: "#/definitions/GxJsonError"
        500401:
          description: "InternalNot server errorAuthenticated"
          schema:
            $ref: "#/definitions/GxJsonError"
     post:   404:
   tags:         - TApRegion
      operationIddescription: "InsertTApRegion"Data with the specified key could not summary:be found"Insertar
las Regiones de un País Registrados en el Sistema"  schema:
    parameters:         - in$ref: header"#/definitions/GxJsonError"
          name500:
Content-Type           typedescription: "stringInternal server error"
          requiredschema:
 true           default$ref: application/json"#/definitions/GxJsonError"

       - inpost:
header      tags:
    name: Authorization   - TApRegion
      typeoperationId: "stringInsertTApRegion"
      summary: "Insertar las Regiones de required:un truePaís Registrados en el Sistema"
      defaultparameters:
OAuth <Access Token>         - in: header
          name: GENEXUSContent-AGENTType
          type: "string"
          required: true
          default: SmartDevice Applicationapplication/json
        - namein: "ApPaiCod"header
          inname: "path"Authorization
          descriptiontype: "Códigostring"
          required: true
          typedefault: "integer"
OAuth <Access Token>
        - formatin: header
"int64"         - name: "ApRegCod"GENEXUS-AGENT
          intype: "pathstring"
          descriptionrequired: "Códigotrue
División Geográfica"           requireddefault: trueSmartDevice Application
        - typename: "integerApPaiCod"
          formatin: "int64path"
        -  namedescription: "TApRegionCódigo"
          inrequired: "body"true
          descriptiontype: "integer"SDT
of TApRegion"           requiredformat: false"int64"
        -  schemaname: "ApRegCod"
           $refin: "#/definitions/TApRegionpath"
       responses:   description: "Código División Geográfica"
  200:           descriptionrequired: "Successfultrue
operation"           schematype: "integer"
           $refformat: "#/definitions/TApRegionint64"
        - 201name: "TApRegion"
         description in: "Createdbody"
          description: "SDT of TApRegion"
          required: false
          schema:
            $ref: "#/definitions/TApRegion"

       400responses:
        200:
          description: "BadSuccessful requestoperation"
          schema:
            $ref: "#/definitions/GxJsonErrorTApRegion"
        401201:
          description: "Not AuthenticatedCreated"
          schema:
            $ref: "#/definitions/GxJsonErrorTApRegion"
        404400:
          description: "DataBad withrequest"
the specified key could not be found"
          schema:
            $ref: "#/definitions/GxJsonError"
        500401:
          description: "InternalNot server errorAuthenticated"
          schema:
            $ref: "#/definitions/GxJsonError"

    put:    404:
  tags:        description: -"Data TApRegionwith the specified key could not be operationId: "UpdateTApRegionfound"
      summary: "Actualizar las Regiones deschema:
un País Registrados en el Sistema"       parameters$ref: "#/definitions/GxJsonError"
       - in500:
header           namedescription: Content-Type"Internal server error"
          typeschema:
"string"            required: true$ref: "#/definitions/GxJsonError"

    put:
     default tags:
application/json
        - in:TApRegion
header      operationId: "UpdateTApRegion"
   name: Authorization  summary: "Actualizar las Regiones de un País Registrados en type:el Sistema"string"
      parameters:
    required: true   - in: header
     default: OAuth <Access Token>
        - in: header
          name: GENEXUSContent-AGENTType
          type: "string"
          required: true
          default: SmartDeviceapplication/json
Application         - namein: "ApPaiCod"header
          inname: "path"Authorization
          descriptiontype: "Códigostring"
          required: true
          typedefault: "integer"
OAuth <Access Token>
        - formatin: "int64"header
         - name: "ApRegCod"GENEXUS-AGENT
          intype: "pathstring"
          descriptionrequired: "Códigotrue
División Geográfica"           requireddefault: trueSmartDevice Application
        - typename: "integerApPaiCod"
          formatin: "int64path"
        -  namedescription: "TApRegionCódigo"
          inrequired: "body"true
          descriptiontype: "SDT of TApRegioninteger"
          requiredformat: true"int64"
        -  schemaname: "ApRegCod"
           $refin: "#/definitions/TApRegionpath"
          description: "Código División Geográfica"
 responses:         200required: true
         description type: "Successful operationinteger"
          schemaformat: "int64"
        -   $refname: "#/definitions/TApRegion"
        400  in: "body"
          description: "BadSDT of requestTApRegion"
          required: true
          schema:
            $ref: "#/definitions/GxJsonErrorTApRegion"
      
 401:     responses:
     description: "Not Authenticated"
 200:
          description: "Successful operation"
          schema:
            $ref: "#/definitions/GxJsonErrorTApRegion"
        404400:
          description: "NotBad foundrequest"
          schema:
            $ref: "#/definitions/GxJsonError"
        409401:
          description: "TApRegionNot Authenticated"
was changed"         500schema:
            description$ref: "Internal server error#/definitions/GxJsonError"
          schema404:
            $refdescription: "#/definitions/GxJsonErrorNot found"
     delete:     schema:
 tags:         - TApRegion $ref: "#/definitions/GxJsonError"
    operationId: "DeleteTApRegion"   409:
   summary: "Eliminar las Regiones de un País Registradosdescription: en"TApRegion elwas Sistemachanged"
      parameters  500:
        -  indescription: header"Internal server error"
          nameschema:
Content-Type            type$ref: "string#/definitions/GxJsonError"

    delete:
    required: true
    tags:
        - TApRegion
      operationId: "DeleteTApRegion"
      default: application/jsonsummary: "Eliminar las Regiones de un País Registrados en el Sistema"
      parameters:
        - in: header
          name: AuthorizationContent-Type
          type: "string"
          required: true
          default: OAuthapplication/json
<Access Token>         - in: header
          name: GENEXUS-AGENTAuthorization
          type: "string"
          required: true
          default: SmartDeviceOAuth <Access ApplicationToken>
        - namein: "ApPaiCod"header
          inname: "path"GENEXUS-AGENT
          descriptiontype: "Códigostring"
          required: true
          typedefault: "integer"SmartDevice Application
         format: "int64"
        - name: "ApRegCodApPaiCod"
          in: "path"
          description: "Código División Geográfica"
          required: true
          type: "integer"
          format: "int64"
       responses: - name: "ApRegCod"
     200:           descriptionin: "Successful operationpath"
          schemadescription: "Código División Geográfica"
          required: true
           $reftype: "integer"
          format: "#/definitions/TApRegionint64"

       204responses:
        200:
          description: "Successful operation"
          schema:
            $ref: "#/definitions/TApRegion"
        400204:
          description: "BadSuccessful requestoperation"
          schema:
            $ref: "#/definitions/GxJsonErrorTApRegion"
        401400:
          description: "NotBad Authenticatedrequest"
          schema:
            $ref: "#/definitions/GxJsonError"
        401:
          description: "Not Authenticated"
          schema:
            $ref: "#/definitions/GxJsonError"
        404:
          description: "Not found"
          schema:
            $ref: "#/definitions/GxJsonError"
        500:
          description: "Internal server error"
          schema:
            $ref: "#/definitions/GxJsonError"


security:
  - OAuth2: []
    ApiKeyAuth1: []
securityDefinitions:
  OAuth2:
    type: oauth2
    flow: password
    tokenUrl: https://test.sifco.org/DemoCoopGT/oauth/access_token
    scopes:
      Execute: Permite el método tipo GET
      Insert: Permite el método tipo POST
      Update: Permite el método tipo PUT
      Delete: Permite el método tipo DELETE
      FullControl: Permite el manejo de los Cuatro Métodos GET, POST, PUT,DELETE, sobre el Web Service
  ApiKeyAuth1:
    type: apiKey
    in: header
    name: granttype

definitions:

  TApRegion:
    properties:
      ApPaiCod:
        description: Código
        type: "integer"
        format: "int64"

      ApPaiNombre:
        description: Paí­s
        type: "string"

      ApRegCod:
        description: Código División Geográfica
        type: "integer"
        format: "int64"

      ApRegDes:
        description: Descripción División Geográfica
        type: "string"

      ApRegGeo:
        description: Geo-Ubicación de Región
        type: "string"

      gx_md5_hash:
        description: gx_md5_hash is an identifier for a specific version of a resource, it is used for optimistic concurrency check. It is required for update and delete operations and  ignored on insert.
        type: "string"


    required:
      - ApPaiCod
      - ApRegCod

  GxJsonError:
    properties:
      error:
        $ref: "#/definitions/GxJsonError.error"

  GxJsonError.error:
    properties:
      code:
        description: Código de Error
        type: "string"

      message:
        description: Mensaje de Error
        type: "string"


    x-gx-level: "GxJsonError" and  ignored on insert.
        type: "string"


    required:
      - ApPaiCod
      - ApRegCod

  GxJsonError:
    properties:
      error:
        $ref: "#/definitions/GxJsonError.error"

  GxJsonError.error:
    properties:
      code:
        description: Código de Error
        type: "string"

      message:
        description: Mensaje de Error
        type: "string"


    x-gx-level: "GxJsonError"

RELACIONES ENTRE EL MODELO DE DATOS DE ESTE WEB SERVICE, Y EL RESTO DEL API’s RESTful DE LA APLICACIÓN SIFCO WEB.

Modelo de Datos de este Web Service

Web Service a Constantes del Sistema Relacionados

TApActEconomica

ApActCod

WSActividadEconomicaLista

EJEMPLOS DE REQUEST Y RESPONSE, PARA LOS SERVICIOS RESTful BAJO PROTOCOLO HTTP.

A continuación se muestra una tabla con un ejemplo de una Solicitud y un Respuesta para este Web Service.

METODO POST

Este método para este Web Service en especifico permite crear Países en la Aplicación SIFCO WEB.

El siguiente ejemplo crea un País en la Aplicación SIFCO WEB.

Tipo de Mensaje HTTP

Ejemplo

REQUEST

URL:

Code Block
https://test.sifco.org/democoopgt/rest/TApRegion/593,2

HEADERS:

Code Block
languagehtml
content-type: application/json
authorization: OAuth f2a9ec34-cf83-46f5-8862-f78........
genexus-agent: SmartDevice Application

BODY:

Code Block
languagejson
{
  "ApPaiCod": 593,
  "ApPaiNombre": "Ecuador",
  "ApRegCod": 2,
  "ApRegDes": "Quito",
  "ApRegGeo": "Ecuador, Quito",
  "gx_md5_hash": "187A23F10E1D215B3086B4CF8C54D35F"
}

201 (Created)

(Registro Creado con Éxito)

Code Block
languagejson
{
  "ApPaiCod": 593,
  "ApPaiNombre": "Ecuador",
  "ApRegCod": 2,
  "ApRegDes": "Quito",
  "ApRegGeo": "Ecuador, Quito",
  "gx_md5_hash": "C72816549823E038BBF6D05560DBB5D1"
}

400 (Bad Request).

Solicitud Errada

Code Block
languagejson
{
  "error": {
    "code": "string",
    "message": "string"
  }
}

401 (This service needs an Authorization Header)

(No Autenticado, asociado normalmente a que no se respetaron las cabeceras obligatorias para el consumo de este Web Service, para mayores detalles consultar (Configuración de Seguridad para Obtener Token de Acceso y Consumir de los Web Services) ).

Code Block
languagejson
{
  "error": {
    "code":"0",
    "msage":"This service needs an Authorization Header"
  }
}

404 (Not Found).

Respuesta Vacía (Web Service, no encontrado)

500 (Internal Server Error)

(Error Interno del Servidor de las API’s REST).

Code Block
{
  "error": {
    "code": "string",
    "message": "string"
  }
}

Info

INFORMACIÓN

Para identificar el MENSAJE DE ERROR remitirse a la pagina de (Listado de Errores) External Call Out, donde se describe el listado de errores que arroja las API’s REST de la Aplicación SIFCO WEB, con su respectiva Descripción.

Note

NO DEBE OLVIDAR

NO olvide que este Web Service, NO REQUIERE seguir algún Flujo de Trabajo especifico por ende se puede utilizar de forma independiente al Flujo de Trabajo descrito en el Web Services de Clientes.

Note

RESPETE LOS ENCABEZADOS OBLIGATORIOS para que pueda consumir el WEB SERVICE respectivo.

Code Block
Content-Type: application/json
Authorization: OAuth f2a9ec34-cf83-46f5-8862-f78ac03670d1!171380a787a9152688ab61a94d66e0eb77...
GENEXUS-AGENT: SmartDevice Application
Warning

EN CASO DE ERROR HTTP 401 (Not Authenticated)

Por favor validar que esta colocando los Encabezados Adecuadamente, y de persistir el problema dirigirse a la Pagina (Configuración de Seguridad para Obtener Token de Acceso y Consumir de los Web Services), para generar nuevamente su Token de Acceso, y/o verificar problemas con su acceso al API REST.

Live Search
spaceKeyDOC
placeholderBúsqueda en esta Pagina
typepage

Enlaces Relevantes

Artículos Relacionados

Filter by label (Content by label)
showLabelsfalse
max5
showSpacefalse
cqllabel in ( "informacion" , "tecnica" , "api" , "rest" , "web" , "services" , "clientes" , "parametros" , "generales" , "region" , "departamento" ) and type = "page" and space = "DOC"

Artículos Actualizados Recientemente

Recent updates
typespage
max5
spacesDOC
themeconcise
hideHeadingtrue
Change History